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 <dmik...@gopivotal.com>wrote:

> On Dec 3, 2013, at 12:14 PM, Tomcat Random <tomcat.ran...@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 <dmik...@gopivotal.com>
> wrote:
> >
> >> On Dec 2, 2013 10:09 PM, "Neven Cvetkovic" <neven.cvetko...@gmail.com>
> >> wrote:
> >>>
> >>> On Dec 2, 2013 12:47 PM, "Tomcat Random" <tomcat.ran...@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-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to