Bug 61032 - min pool size is not being respected
Summary: min pool size is not being respected
Status: NEW
Alias: None
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL: https://github.com/apache/tomcat/pull/54
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-24 18:23 UTC by Jelmer
Modified: 2018-09-09 16:20 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.