|Summary:||min pool size is not being respected|
|Product:||Tomcat Modules||Reporter:||Jelmer <jelmer.terwal>|
|Component:||jdbc-pool||Assignee:||Tomcat Developers Mailing List <dev>|
Description Jelmer 2017-04-24 18:23:51 UTC
The problem seems not to be specific for a tomcat version. However, the version used on production which showed the problem is 8.5.9 (org.apache.tomcat:tomcat-jdbc:8.5.9). Used together with Java 8, but Java 7 should have similar results. The tomcat documentation indicates a minimum pool of idle connections should be available. It scared me when I first saw this dropped below the minimum size. From the documentation at https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html (or https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html, the version I used); minIdle - (int) The minimum number of established connections that should be kept in the pool at all times. The connection pool can shrink below this number if validation queries fail. Default value is derived from initialSize:10 (also see testWhileIdle) I created a PR for this problem at https://github.com/apache/tomcat/pull/54.
Comment 1 sakala.ramesh 2018-09-09 15:58:47 UTC
I am also running into this issue. My understanding of minIdle is the number of connections readily available in the pool at all times to avoid creating on-demand. We are seeing the number of of total connections (idle+busy) to fall below minIdle connections This causes performance issues and also potential issues by increasing the number of occurrences of having to create the connection when application needs one. I notices this issue and the PR is created in early 2017, more than a year ago. How is everyone working around the issue?
Comment 2 sakala.ramesh 2018-09-09 16:20:15 UTC
PoolCleaner is closing connections when idle connection count is more than minIdle. It should not do that as pool is expected to always have more than minIdle connections in the idle queue ready to be issued. Instead, it should create connections and add to idle queue if idle queue size is less than minIdle.