Gremlin Dotnet Connection Pools

433 views
Skip to first unread message

Austin Malpede

unread,
Jul 23, 2019, 12:26:53 AM7/23/19
to Gremlin-users
Hello,

I have a question regarding connection pool settings.

In what order will gremlin requests flow through the connection pool? Will each subsequent request use a different websocket connection in a round robin fashion? Or will each websocket connection fill up until the MaxInProcessPerConnection is reached and then start using the next websocket?

Thanks,
Austin

Florian Hockmann

unread,
Jul 23, 2019, 2:19:14 AM7/23/19
to Gremlin-users
In what order will gremlin requests flow through the connection pool?

There is no buffering of any sort. So, requests are executed in the order they arrive without any delays. If no connection is available at that moment, then an exception is thrown to inform you that the pool reached its limits and you have to either send less requests in parallel or increase the limits.

Will each subsequent request use a different websocket connection in a round robin fashion?

Yes, exactly. The pool schedules through the connections in a round robin fashion. However, a connection is only used if it hasn't reached its MaxInProcessPerConnection limit. If all connection but one have reached this limit, then all requests will be executed over this one connection until another connection falls below the limit.

This is implemented in the TryGetAvailableConnection method.

Austin Malpede

unread,
Jul 30, 2019, 10:34:01 AM7/30/19
to Gremlin-users
Thanks for the response Florain!

Is there any way to ensure that if the connection pool size is 4, then the DNS resolves for each socket opened up?

The database I am using has a read-only endpoint which routes websockets to reader instances in a round robin fashion. It only does this each time a DNS entry is resolved. It appears that the DNS is only resolved once so im only able to connect to a single reader instance.

If what i'm asking above is not achievable, I could always connect to the reader instances directly. Is there any way I could have multiple endpoints to connect to within a single gremlin client? I understand this is possible for other GLV's, however I don't see this functionality available within Gremlin.Net

Austin Malpede

unread,
Jul 30, 2019, 11:59:14 PM7/30/19
to Gremlin-users
Sorry let me rephrase the question. Is there any way to get the equivalent of this code in Gremlin.Net?


Cluster.Builder readerBuilder = Cluster.build()
         
.port(8182)
         
.minConnectionPoolSize(…)
         
.maxConnectionPoolSize(…)
         
………
         
.addContactPoint("
reader-endpoint-1")
         
.addContactPoint("
reader-endpoint-2")

Florian Hockmann

unread,
Aug 1, 2019, 3:35:38 AM8/1/19
to Gremlin-users
Is there any way to ensure that if the connection pool size is 4, then the DNS resolves for each socket opened up?

The connections are opened in parallel during the initialization of the connection pool. I'm not sure however whether this involves sending 4 DNS requests or just one. You could try that out by capturing the network traffic with something like tcpdump or Wireshark.

Is there any way to ensure that if the connection pool size is 4, then the DNS resolves for each socket opened up?

No, that's not possible yet, but we have an open feature request for this functionality: https://issues.apache.org/jira/browse/TINKERPOP-1765
You could use a load balancer in front of your servers that handles load balancing for you.
Reply all
Reply to author
Forward
0 new messages