-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1230 Disposing ConnectionPool that are not actively used under LRU policy. #1259
Conversation
@jun-lee Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@jun-lee Thank you for signing the Contributor License Agreement! |
@jun-lee With issue #1230 do you want to remove the connections that reached their TTL within a connection pool or to remove a connection pool from the map with all connections pool? The feature request in Reactor Pool is for removing the connections that reached their TTL within a connection pool. While with this PR you want to remove a connection pool from the map with all connection pools. How do you guarantee that the connection pool, that's going to be destroyed, does not have active connections at the moment? |
@violetagg In my application, if I'm using enough numbers for the limit, removing entry by LRU policy is a kind of the desired feature, rather than keeping them a long time or causing another heavy evicting operation that checks that all the connections in a pool have reached to TTL. I have tested that the simultaneous new request that establishing a new ConnectionPool to the destroying connection pool was not causing any problem either. |
We still do not have this background eviction from Reactor Pool, so currently the connections are checked for TTL only when they are released/acquired.
Let say that the connection pool is empty then the cleanup from the map should not be done based on the eldest but based on
Let say that you destroy a connection pool with connections (active or idle). Then you are right this will not cause problems as the next request for a connection will create it again, BUT then you have to pay the price for establishing again a new connection to the remote host. What if your eldest connection pool is the most heavy used at the moment? |
Yeah this PR is not supposed to be merged. We need to hit the map by calling get() on the acquiring Operation as well to put the most heavy one at the recently accessed position. I just want to point that the root cause of my application was the growing entities of the map holding the connection pools. If there is any way to clean up the connection pool and related PoolKey that holding InetAddress of the remote host, then it would work for my application. |
@jun-lee So from what I understood you connect to many different remote hosts, is this correct? |
Yes, that's what I have just found and I now can handle the LRU from my applicaion side. And it works well. Thanks for the help. |
Based on the issue(#1230), I'm thinking that it can be on the
reactor-netty
application layer as well, instead of adding consumer logic into thereactor-pool
.