tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Rellis <john.d.rel...@gmail.com>
Subject Re: minIdle not being respected (tomcat thread pool)
Date Wed, 09 Oct 2013 16:58:55 GMT
On Tue, Oct 8, 2013 at 5:42 AM, Daniel Mikusa <dmikusa@gopivotal.com> wrote:
> On Oct 7, 2013, at 11:14 PM, John Rellis <john.d.rellis@gmail.com> wrote:
>
>> Hi,
>>
>> Tomcat : 7.0.33
>> Java : 6
>> JDBC Pool : 1.0.9.3
>> Grails : 1.3.9
>>
>> We are running a grails app that is using the tomcat JDBC thread pool, what
>> we are seeing is the idle connections falling below minIdle and then
>> continuously heading towards zero over the course of a few hours.
>>
>> I think I understand that if validation fails on a connection or a
>> connection becomes abandoned, it will be removed from the pool but
>> shouldn't the pool attempt to climb back up to minIdle
>> every timeBetweenEvictionRunsMillis??  We are not seeing this behaviour at
>> all.
>
> I don't believe so.  The pool cleaner checks for abandoned and idle connections.  It
first looks at the number of idle connections and checks to see if there are too many idle
connections hanging around.  If there are, it checks to see if it can release any connections.
 Then if configured to, it validates idle connections.  The important thing to note is that
it only removes connections, it won't add new ones.
>
> If you want to take a look check out the PoolCleaner class here.
>
>    https://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
>
>> I am really confused by the behaviour I am seeing so any help that stops
>> our connections tending towards zero is greatly appreciated!
>
> It sounds like your connections might be failing validation.  Since you're validation
query looks good, perhaps the connections are being disconnected from the server or a firewall
in between your Tomcat server and database server.  Does your database server have it have
a connection timeout?  If there is a firewall, does it restrict how long connections can remain
open and idle?
>
> Dan
>
>>
>>
>> -------- The Grails WAR contains ----------
>>
>> com.springsource.org.apache.juli.extras-6.0.24.jar
>> com.springsource.org.apache.tomcat.jdbc-1.0.9.3.jar
>>
>> --------- Datasource parameters  ----------
>> *
>> *
>> *      *  maxActive = 100
>>        maxIdle = 100
>>        minIdle = 80
>>        initialSize = 100
>>        maxWait = 5000
>>        validationQuery = 'SELECT 1'
>>        validationInterval = 30000//validate at most every 30 seconds
>>        testWhileIdle = true
>>        logAbandoned = true
>>        removeAbandoned = true
>>        removeAbandonedTimeout = 300//seconds
>>        timeBetweenEvictionRunsMillis = 60000//run evictor every minute
>>        minEvictableIdleTimeMillis = 3600000//anything idle for more than
>> an hour, evict, I am assuming validation means they will not be idle
>>
>>
>> ------ Debug Print out to the log --------
>>
>> Pool Name : Tomcat Connection Pool[1-882332278]
>> Initial Size : 100
>> Active Connection : 1
>> Idle Connection : 66
>> Size : 81
>>
>> Max Active Connections : 100
>> Max Age : 0
>> Max Idle : 100
>> Min Idle : 80
>> Max Wait : 5000
>>
>> Log Abandoned : true
>> Remove Abandoned : true
>> Remove Abandoned Timeout : 300
>>
>> timeBetweenEvictionRunsMillis : 60000
>> minEvictableIdleTimeMillis : 3600000
>>
>> Validation Query : SELECT 1
>>
>>
>> --
>> John Rellis
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


Thanks Daniel.

This helped us figure out that the connections were actually falling
out of the pool because they were becoming abandoned.  There's
something causing some queries to hang but that is another issue.

My understanding of minIdle is that it prevents evictions from taking
connections out of the pool once minIdle is reached.

We can return the dataSource connection settings to sane levels now
that we know what is going on, it looks like our app is happy enough
with circa 10 connections which is great.

-- 
John Rellis

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message