In a scenario when one java application instance can talk to multiple Gremlin servers (say multiple graph instances in CosmosDB). What is the recommendation for creating and caching Gremlin Clients in such a case. Looks like on my mac maximum number of Cluster instances I can create is less than 300. Beyond that I get "Too many files open exception".
caused by: java.io.IOException: Too many open files
java.lang.IllegalStateException: failed to create a child event loop
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:88)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:86)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:81)
at io.netty.channel.nio.NioEventLoopGroup.<init>(NioEventLoopGroup.java:68)
at org.apache.tinkerpop.gremlin.driver.Cluster$Factory.<init>(Cluster.java:1065)
Is there a way around it? This is what is being done for many different values of graphUserName
.
final Cluster cluster = Cluster.build()
.addContactPoint("host")
.port(443)
.credentials(graphUserName,
"graph-password")
.serializer("serializer)
.enableSsl(true)
.create();
cluster.connect());