tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tomcat Random <tomcat.ran...@gmail.com>
Subject Re: Pooled Connections Lost After 10 Minutes (600 seconds)
Date Tue, 03 Dec 2013 18:28:10 GMT
Thanks, that's good to know, especially about the validationInterval
setting. The idea of not validating every single time seems more reasonable.

-Alec


On Tue, Dec 3, 2013 at 12:32 PM, Daniel Mikusa <dmikusa@gopivotal.com>wrote:

> On Dec 3, 2013, at 12:14 PM, Tomcat Random <tomcat.random@gmail.com>
> 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 interval.
>
> ...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.
>
> Dan
>
> >
> > On Tue, Dec 3, 2013 at 7:24 AM, Daniel Mikusa <dmikusa@gopivotal.com>
> wrote:
> >
> >> On Dec 2, 2013 10:09 PM, "Neven Cvetkovic" <neven.cvetkovic@gmail.com>
> >> wrote:
> >>>
> >>> On Dec 2, 2013 12:47 PM, "Tomcat Random" <tomcat.random@gmail.com>
> >> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message