You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by GitBox <gi...@apache.org> on 2021/09/15 00:18:36 UTC
[GitHub] [tinkerpop] simonz-bq commented on pull request #1465: TINKERPOP-2486 Fix load balancing across connections
simonz-bq commented on pull request #1465:
URL: https://github.com/apache/tinkerpop/pull/1465#issuecomment-919600535
I updated the connection pool logic a bit to be simpler and to solve the load balancing issues due to race conditions.
In my opinion the change seems reasonable but there may be a side effect that I haven't considered or figured out.
Aside from the load balancing issues, the old and new logic work as follows for getting a connection:
1. Grab the least used connection
2. If no connection could be returned, wait for one to be available
3. If the least used connection's borrow count is higher than `maxSimultaneousUsagePerConnection`, consider making a new connection if the pool is not full. **Even if `maxSimultaneousUsagePerConnection`, this least used connection is still considered a valid connection to return**
4. If the least used connection's borrow count is higher than `maxSimultaneousUsagePerConnection` AND the least used connection has reached it's maximum processes, wait for one to be available
5. Else, return the least used connection
The old logic allowed a connection to be grabbed even if `maxSimultaneousUsagePerConnection` was exceeded, and only deemed it invalid if also the maximum processes was reached.
New:
1. Grab the least used connection that is below the `maxSimultaneousUsagePerConnection` count
2. Increment the borrow count, and if it now reaches `maxSimultaneousUsagePerConnection`, consider creation of a new connection
3. If a least used connection could not be grabbed, then wait for one to be available
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org