i see that Idle connections are not getting cleared. I am not sure what the reason is?
initialSize-10 maxtotal-20 maxidle-10 minidle-0 minEvictableIdleTimeMillis-30min numTestsPerEvictionRun-60min numTestsPerEvictionRun-20 testOnBorrow-true testWhileIdle-true validationQuery-select 1 from dual
From various sources provided the following is my understanding maxtotal- maxactive connections to Datasource which is 20 in above case
maxidle- number of idle connections that can remain in pool. these are removed by the sweeper. In the above case, a connection is idle if it remains idle for 30min. If the sweeper runs every 60min which checks 20 idle connections to and clears idle connections. Idle connections exceeding this would be closed immediately.
Is the above understanding correct?
I am using BasicDataSourceMXBean to print the stats
{"NumActive":"0","NumIdle":"10","isClosed":"false","maxTotal":"20","MaxIdle":"10","MinIdle":"0"}
The idle connections are never getting cleared even though there is no traffic. Is there anything wrong in the above config?
Also what is minIdle and when should we set it to non zero value?
Recently upgraded hibernate version from 3.6.0.Final to hibernate 4.3.11.Final and spring to 4.2.9 from older spring version.
Earlier the idle connections were getting cleared. But since the upgrade the idle connections are not getting cleared.
testWhileIdle
rather thantestOnIdle
for idle connections to be evicted? – Naros