Gremlin.Net Connection Pool Repairing

165 views
Skip to first unread message

Austin Malpede

unread,
Dec 5, 2019, 3:21:45 PM12/5/19
to Gremlin-users
Hello,

One of my favorite parts about the GremlinClient within Gremlin.Net is that if the tinkerpop server is restarted, the client will attempt to repair the dropped connections the next time a query is submitted. This behavior is very valuable.

In the 3.4.0 release ConnectionPoolSettings were added to the GremlinClient constructor which allows configuring the PoolSize and MaxInProcessPerConnection. 

Let's say that I set my pool size to be 4, after constructing the client 4 websocket connections will be created. Now lets say that after some time one of the 4 connections times out leaving 3 open connections. Will the client detect this and attempt to re-establish the pool size defined in the connection pool settings? Or will the client only attempt to repair itself after all connections close?

Thanks,
Austin

Florian Hockmann

unread,
Dec 6, 2019, 5:04:55 AM12/6/19
to Gremlin-users
Hi Austin,

what should happen in such a case is that the next time the connection pool iterates over this closed connection to find an available connection to submit a request, it removes this dead connection from its pool. The next request that comes in after that will then trigger the creation of a new connection to bring the pool back to its configured size.
So, yes the client can repair itself after a single connection was closed. The only thing to keep in mind is that this is only triggered by requests that should be submitted as there are currently no background operations in the driver to check and re-establish connections. This can lead to exceptions when all connections have been closed between two requests as then no connection will be available for the request. This ticket contains more information about this problem if you're interested.
Reply all
Reply to author
Forward
0 new messages