jefferyyuan created POOL-353:
--------------------------------

             Summary: Return false if current connection count is less then 
MinIdle in DefaultEvictionPolicy
                 Key: POOL-353
                 URL: https://issues.apache.org/jira/browse/POOL-353
             Project: Commons Pool
          Issue Type: Improvement
    Affects Versions: 2.6.0
            Reporter: jefferyyuan
             Fix For: 3.0, 2.6.1


At 
[https://github.com/apache/commons-pool/blob/master/src/main/java/org/apache/commons/pool2/impl/BaseGenericObjectPool.java#L1140]

It first evicts idle connections, then re-creates idle instances to 
ensureMinIdle.

DefaultEvictionPolicy will close idle connection even when there is <= MinIdle 
connections.

https://github.com/apache/commons-pool/blob/master/src/main/java/org/apache/commons/pool2/impl/DefaultEvictionPolicy.java

 

In case minIdle is set to large, it would causes problems like frequent full GC.
 * the connection related objects are promoted and stored in old gen, then 
evict will close them and make it gc-able, and ensureMinIdle will create new 
connections which will be eventually promoted to old gen and gc-able again.
 * Old gen will grow quickly and need full gc.

We can solve the problem if we always keep minIdle connections in the 
DefaultEvictionPolicy.

Or at least add doc to DefaultEvictionPolicy and may provide another 
EvictionPolicy which returns false if current connection count is less then 
MinIdle and refer it in  DefaultEvictionPolicy.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to