avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: SELECT 1
Date Tue, 22 Jan 2002 13:33:07 GMT
Leif Mortenson wrote:

> Danny Angus wrote:
>> Hi all,
>> tailing MySQL logs whilst running James I found a regular "SELECT 1" 
>> being
>> run, which I now think is  being used to ping the connection.
>> However my question is should it be "pung" (Scottish for "pinged" ;) even
>> when queries are being regularly executed?
>> It also seems to be run only when another query is being run anyway.
>> Could someone explain this?
> The data source validates connections before returning them so that any 
> problems with the connection can be discovered before returning the bad 
> connection to the user code.  This gives the data source the opportunity 
> to close the bad connection and create a new good connection and 
> transparently return that to the user code so the user code never breaks.
> Unfortunately if you write your code so that a connection is allocated 
> and then closed for each query, then the number of DB queries is doubled.
> I had written a database pool last year which got around this problem by 
> keeping track of the last time the connection was released.  Then the 
> ping was only made if that time was greater than 5 seconds.  This made a 
> big difference by cutting the pings down to nil when the application is 
> heavily loaded.  The thinking is that when the queries are spaced close 
> together, the fact that the previous query was successful gives the same 
> information as the ping would, so it is not necessary.
> What about implementing something like this in Avalon's data sources as 
> well?  Drawbacks?

+1, give me a patch and I can apply it!


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message