Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Thu, 13 Nov 2014 17:40:05 -0500 Perrin Harkins phark...@gmail.com 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

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Perrin Harkins
On Fri, Nov 14, 2014 at 7:58 AM, Vincent Veyron vv.li...@wanadoo.fr 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

Re: Disconnect database connection after idle timeout

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

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Fri, 14 Nov 2014 08:30:18 -0500 Perrin Harkins phark...@gmail.com 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

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Perrin Harkins
On Fri, Nov 14, 2014 at 1:32 PM, Xinhuan Zheng xzh...@christianbook.com 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

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Dave Morgan
To: Xinhuan Zheng xzh...@christianbook.com mailto:xzh...@christianbook.com, modperl modperl@perl.apache.org 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 Dave Morgan
On 11/13/2014 09:42 AM, Perrin Harkins wrote: On Thu, Nov 13, 2014 at 11:29 AM, Dr James Smith j...@sanger.ac.uk 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

Re: Disconnect database connection after idle timeout

2014-11-14 Thread Vincent Veyron
On Thu, 13 Nov 2014 10:43:35 -0500 Perrin Harkins phark...@gmail.com 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
modperl@perl.apache.orgmailto: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 in the cleanup handler that calls the disconnect after a specified amount of time. If a new

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
? - xinhuan From: Paul Silevitch p...@silevitch.com Date: Wednesday, November 12, 2014 at 11:53 PM To: Xinhuan Zheng xzh...@christianbook.com, modperl modperl@perl.apache.org Subject: Re: Disconnect database connection after idle timeout I don't fully understand your need here. I'm going

Re: Disconnect database connection after idle timeout

2014-11-13 Thread John Dunlap
: Wednesday, November 12, 2014 at 11:53 PM To: Xinhuan Zheng xzh...@christianbook.com, modperl 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 in the cleanup handler

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
@perl.apache.orgmailto:modperl@perl.apache.org Subject: Re: Disconnect database connection after idle timeout We use PGBouncer on the web server(which handles keep-alive to the database) and then we use Apache::DBI across localhost to talk to PGBouncer. On Thu, Nov 13, 2014 at 9:56 AM, Perrin Harkins phark

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 10:29 AM, Xinhuan Zheng 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 requests, and tune your configuration so that idle mod_perl

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 xzh...@christianbook.com 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

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 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 lots of risks It's certainly good to know how long it

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
@perl.apache.orgmailto:modperl@perl.apache.org Subject: Re: Disconnect database connection after idle timeout On Thu, Nov 13, 2014 at 11:29 AM, Dr James Smith j...@sanger.ac.ukmailto:j...@sanger.ac.uk wrote: From experience - and having chatted with our DBAs at work, with modern Oracle and with MySQL keeping

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 10:43:35 -0500 Perrin Harkins phark...@gmail.com 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 12:21 PM, Vincent Veyron vv.li...@wanadoo.fr 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng xzh...@christianbook.com 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

Re: Disconnect database connection after idle timeout

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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
...@gmail.com Date: Thursday, November 13, 2014 at 12:50 PM To: Xinhuan Zheng xzh...@christianbook.com Cc: Dr James Smith j...@sanger.ac.uk, 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread John Dunlap
j...@sanger.ac.uk, 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...@christianbook.com wrote: Having another tier (like DBD::Gofer) looks like really messy in infrastructure plus

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
connection after idle timeout On Thu, Nov 13, 2014 at 12:19 PM, Xinhuan Zheng xzh...@christianbook.com 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Xinhuan Zheng
@perl.apache.orgmailto:modperl@perl.apache.org Subject: Re: Disconnect database connection after idle timeout Yes, it's an HTTP proxy. It handles sending out the bytes to remote clients, so that your mod_perl server doesn't have to. A popular high-performance choice these days is nginx. There's some discussion of why

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 12:45:09 -0500 Perrin Harkins phark...@gmail.com 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 Perrin Harkins
On Thu, Nov 13, 2014 at 2:48 PM, Vincent Veyron vv.li...@wanadoo.fr 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 2:41 PM, Xinhuan Zheng xzh...@christianbook.com 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Vincent Veyron
On Thu, 13 Nov 2014 16:35:59 -0500 Perrin Harkins phark...@gmail.com 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 5:29 PM, Vincent Veyron vv.li...@wanadoo.fr 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

Re: Disconnect database connection after idle timeout

2014-11-13 Thread Perrin Harkins
On Thu, Nov 13, 2014 at 5:38 PM, Xinhuan Zheng xzh...@christianbook.com 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

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

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