Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Thu, 13 Nov 2014 10:43:35 -0500 Perrin Harkins wrote: > Apache::DBI should also re-connect with no problems if a request comes in > after a connection has timed out. If that isn't happening, make sure you > are using Apache::DBI properly. > Hi Perrin, Nobody suggested using connect_cached,

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Dave Morgan
On 11/13/2014 09:42 AM, Perrin Harkins wrote: On Thu, Nov 13, 2014 at 11:29 AM, Dr James Smith mailto:j...@sanger.ac.uk>> wrote: From experience - and having chatted with our DBAs at work, with modern Oracle and with MySQL keeping persistent connections around is no real gain and usually

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Dave Morgan
r 12, 2014 at 11:53 PM To: Xinhuan Zheng mailto:xzh...@christianbook.com>>, modperl mailto:modperl@perl.apache.org>> Subject: Re: Disconnect database connection after idle timeout I don't fully understand your need here. I'm going to give my best. You could set an alarm

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Perrin Harkins
On Fri, Nov 14, 2014 at 1:32 PM, Xinhuan Zheng wrote: > Are you implying that the performance will be suffered when using > mod_perl-enabled server processes as the front tier servers? Not performance, scalability. You can't handle as many requests per second if you use mod_perl without a front

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Fri, 14 Nov 2014 08:30:18 -0500 Perrin Harkins wrote: > If you ever switch off AutoCommit in > your code, I'd suggest adding a cleanup handler that checks if the handle > is not currently in AutoCommit mode, and if not, issues a rollback and > switches it to AutoCommit. That protects against a

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Xinhuan Zheng
t;> Date: Thursday, November 13, 2014 at 5:49 PM To: Xinhuan Zheng mailto:xzh...@christianbook.com>> Cc: mod_perl list mailto:modperl@perl.apache.org>> Subject: Re: Disconnect database connection after idle timeout On Thu, Nov 13, 2014 at 5:38 PM, Xinhuan Zheng mailto:xzh...@christianbook.c

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Perrin Harkins
On Fri, Nov 14, 2014 at 7:58 AM, Vincent Veyron wrote: > If I understand correctly, I could also use Apache::DBI and a persistent > connection for a similar result, modulo what you wrote in an earlier > message regarding the connection being more explicit (which I don't quite > grasp, I'll have t

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Thu, 13 Nov 2014 17:40:05 -0500 Perrin Harkins wrote: > > No, that's perfect. Since pnotes gets cleaned up at the end of every > request, there's no danger of the handle sticking around. I assume you're > calling DBI->connect() to get the handle in the HeaderParser phase, and > using Apache::

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 5:38 PM, Xinhuan Zheng wrote: > We have load balancer cache that can cache images and JavaScripts. This > functions seems a bit duplicate. It's not about caching. Here's a quote from that link I sent earlier: "Another drawback of this approach is that when serving outpu

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 5:29 PM, Vincent Veyron wrote: > I stash a reference to a DBI handle in pnotes during the HeaderParser > phase of my requests; I then refer to this handle for every request in my > PerlResponseHandlers. > > This seems to have been working fine for several months. Am I doin

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
To: Xinhuan Zheng mailto:xzh...@christianbook.com>> Cc: mod_perl list mailto:modperl@perl.apache.org>> Subject: Re: Disconnect database connection after idle timeout On Thu, Nov 13, 2014 at 2:41 PM, Xinhuan Zheng mailto:xzh...@christianbook.com>> wrote: >From the description of the

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 16:35:59 -0500 Perrin Harkins wrote: > > Keep in mind, neither of these work unless you call > DBI->connect()/connect_cached() at the beginning of every request. You > can't just keep a DBI handle stashed somewhere and expect that to work. > h... you're having me worrie

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 2:41 PM, Xinhuan Zheng wrote: > From the description of the document, the “proxy” server acts much like a > memcache but it appears the difference is the “proxy” understands the HTTP > protocol while memcache does not. Not exactly. While it is possible to do some caching

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 2:48 PM, Vincent Veyron wrote: > But then, what is the point of using connect_cached? You can use it outside of mod_perl. You can also use instead of Apache::DBI if you don't want the connection to be more explicit (instead of magically overriding the connect() call). K

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 12:45:09 -0500 Perrin Harkins wrote: > Well, Apache::DBI should already be doing a ping and a successful > re-connect if needed. Haha, thanks for your answer. I have so much to learn... But then, what is the point of using connect_cached? --

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
HTTP request? Thanks, - xinhuan From: Perrin Harkins mailto:phark...@gmail.com>> Date: Thursday, November 13, 2014 at 12:50 PM To: Xinhuan Zheng mailto:xzh...@christianbook.com>> Cc: Dr James Smith mailto:j...@sanger.ac.uk>>, mod_perl list mailto:modperl@perl.apache.org>>

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
gt; I don’t quite understand what you mean by setting up a front-end >>> proxy. What would you expect this “proxy” do? Does it take HTTP request? >>> >>> Thanks, >>> - xinhuan >>> >>> From: Perrin Harkins >>> Date: Thursday, Novembe

Re: Disconnect database connection after idle timeout

2014-11-13 Thread John Dunlap
r 13, 2014 at 12:50 PM >> To: Xinhuan Zheng >> Cc: Dr James Smith , mod_perl list < >> modperl@perl.apache.org> >> Subject: Re: Disconnect database connection after idle timeout >> >>On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng < >> xzh...@c

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
Perrin Harkins > Date: Thursday, November 13, 2014 at 12:50 PM > To: Xinhuan Zheng > Cc: Dr James Smith , mod_perl list < > modperl@perl.apache.org> > Subject: Re: Disconnect database connection after idle timeout > >On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng &l

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
to:xzh...@christianbook.com>> Cc: Dr James Smith mailto:j...@sanger.ac.uk>>, mod_perl list mailto:modperl@perl.apache.org>> Subject: Re: Disconnect database connection after idle timeout On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng mailto:xzh...@christianbook.com>> wrote:

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng wrote: > Having another tier (like DBD::Gofer) looks like really messy in > infrastructure plus it’s not certain who is going to maintain that module’s > quality. I'd only recommend trying it after you set up a front-end proxy, tune your mod_perl

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 12:21 PM, Vincent Veyron wrote: > Nobody suggested using connect_cached, where the documentations says : > > The cached database handle is replaced with a new >connection if it has been disconnected or if the "ping" method fails > > Would that not solve OP's proble

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 10:43:35 -0500 Perrin Harkins wrote: > Apache::DBI should also re-connect with no problems if a request comes in > after a connection has timed out. If that isn't happening, make sure you > are using Apache::DBI properly. > Hi Perrin, Nobody suggested using connect_cached,

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
t;> Subject: Re: Disconnect database connection after idle timeout On Thu, Nov 13, 2014 at 11:29 AM, Dr James Smith mailto:j...@sanger.ac.uk>> wrote: >From experience - and having chatted with our DBAs at work, with modern Oracle >and with MySQL keeping persistent connections around is n

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 11:29 AM, Dr James Smith wrote: > From experience - and having chatted with our DBAs at work, with modern > Oracle and with MySQL keeping persistent connections around is no real gain > and usually lots of risks It's certainly good to know how long it takes to get a fres

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Dr James Smith
On 13/11/2014 15:43, Perrin Harkins wrote: On Thu, Nov 13, 2014 at 10:29 AM, Xinhuan Zheng mailto:xzh...@christianbook.com>> wrote: We don’t have any front end proxy. I think I see the problem... ;) If you use a front-end proxy so that your mod_perl servers are only handling mod_perl re

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 10:29 AM, Xinhuan Zheng wrote: > We don’t have any front end proxy. I think I see the problem... ;) If you use a front-end proxy so that your mod_perl servers are only handling mod_perl requests, and tune your configuration so that idle mod_perl servers don't sit around

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
o hard to implement? - xinhuan From: Paul Silevitch mailto:p...@silevitch.com>> Date: Wednesday, November 12, 2014 at 11:53 PM To: Xinhuan Zheng mailto:xzh...@christianbook.com>>, modperl mailto:modperl@perl.apache.org>> Subject: Re: Disconnect database connection after idle timeout I don&

Re: Disconnect database connection after idle timeout

2014-11-13 Thread John Dunlap
y. Would it be possible to implement that? Or is it too hard >> to implement? >> >> - xinhuan >> >> From: Paul Silevitch >> Date: Wednesday, November 12, 2014 at 11:53 PM >> To: Xinhuan Zheng , modperl < >> modperl@perl.apache.org> >> Subj

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
? Or is it too hard > to implement? > > - xinhuan > > From: Paul Silevitch > Date: Wednesday, November 12, 2014 at 11:53 PM > To: Xinhuan Zheng , modperl < > modperl@perl.apache.org> > Subject: Re: Disconnect database connection after idle timeout > > I don&#

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
rg>> Subject: Re: Disconnect database connection after idle timeout I don't fully understand your need here. I'm going to give my best. You could set an alarm in the cleanup handler that calls the disconnect after a specified amount of time. If a new request comes in, you

Re: Disconnect database connection after idle timeout

2014-11-12 Thread Paul Silevitch
I don't fully understand your need here. I'm going to give my best. You could set an alarm in the cleanup handler that calls the disconnect after a specified amount of time. If a new request comes in, you could cancel the alarm in a postreadrequest handler (or something early in the cycle). To

Disconnect database connection after idle timeout

2014-11-12 Thread Xinhuan Zheng
Hello, I am having a database connection management question. Our apache+mod_perl application initiates a database connection request when it needs to then do data processing. Afterwards, if there is no more requests coming to this apache process, the database connection basically will be sitti