Re-use the client object across multiple threads - Amazon Neptune
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Re-use the client object across multiple threads

Re-use the same client (or GraphTraversalSource) object across multiple threads. That is, create a shared instance of a org.apache.tinkerpop.gremlin.driver.Client class in your application rather than doing so in every thread. The Client object is thread safe, and the overhead of initializing it is considerable.

This also applies to GraphTraversalSource, which creates a Client object internally. For example, the following code causes a new Client object to be instantiated:

import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal; ///// GraphTraversalSource traversal = traversal() .withRemote(DriverRemoteConnection.using(cluster));