tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <>
Subject Re: Pooled Connections Lost After 10 Minutes (600 seconds)
Date Tue, 03 Dec 2013 17:32:14 GMT
On Dec 3, 2013, at 12:14 PM, Tomcat Random <> wrote:

> I considered using a validation query but it seemed like extra overhead
> when the default behavior was not, um, behaving in the default way.

The overhead is typically minimal.  Running "SELECT 1" or some other very simply query is
not likely to bring your database to it's knees.  It might add a small amount of latency as
the pool will need to execute the query before it give the connection to your application,
but that's likely to be dwarfed by whatever your application does with the connection after
it gets it.

If you are concerned you can do a couple things to make the process even more lightweight.

1.) With MySQL and use "/* ping */ SELECT 1" as the validation query.  This is a special case
with the MySQL JDBC driver that uses even less resources.

2.) You can use the tomcat-jdbc connection pool which has a validationInterval setting.  This
will ensure that the validation query is only executed one time during the specified time

...or you can go without a validation query, but it's not something I would recommend and
not something I see done very often.  The minimal overhead is usually worth knowing that you
get a valid connection from the pool.


> On Tue, Dec 3, 2013 at 7:24 AM, Daniel Mikusa <> wrote:
>> On Dec 2, 2013 10:09 PM, "Neven Cvetkovic" <>
>> wrote:
>>> On Dec 2, 2013 12:47 PM, "Tomcat Random" <>
>> wrote:
>>>> Neven, thank you.
>>>> It was right there in my.cnf: 'wait_timeout=600'
>>> You're welcome :)
>>> I am curious why tomcat didn't renew expired (terminated) idle
>> connections
>>> though.
>> It wouldn't know that the connections have been disconnected, since they
>> were disconnected server side.  If the user added a validation query then
>> it could detect and remove the closed connections.
>> Dan

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message