I had started working on implementing an improved the connection pool handling 
for Gremlin.NET, which I based very closely on the java gremlin-driver 
connection pool implementation.

It attempted to solve the similar areas that this PR is addressing as well as 
few other key areas:

- Select connections based on least used, then based on last activity, to 
ensure that activity is shared across the pool (important for Cosmos DB Gremlin 
API where connections will be timed if there is no request activity).
- Avoid racing request from selecting the same connection.
- Schedule creating new connection when capacity is available. This will done 
when connection could not be selected from the pool, and can remove a dead 
connection in order to make room for a new connection.
- Allow requests to wait for a connection to become available if the pool is 
busy/connections are being created. These will time-out based on a setting.
- If a dead connection is returned by a request, create a replacement 
connection.
- Only consider the pool closed/service unavailable if the pool is unable to 
reconnect for some timeout.

I used a `lock`/`List<T>` to manage the actual connection pool (though there 
are other options that I was considering for this).

I've created a PR on my fork 
[here](https://github.com/olivertowers/tinkerpop/pull/1).

I was planning on proposing this solution, and I didn't see this PR until today.

Do we think it's possible to merge/reconcile some of these capabilities with 
this PR?


[ Full content available at: https://github.com/apache/tinkerpop/pull/1077 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to