Re: DBI persistence problem
[prev]
[thread]
[next]
[Date index for 2004/12/02]
--=-k15xBp6T8qH3raJw+nDI
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Malcom and Perrin,
Thank you for your quick replies!
1. We disabled Apache::DBI - the server can generate thousands of
queries per second and this feature literally made the CPU catch fire.
2. Understood about placing the connect strings in startup.PL. That's
why we wrote the list first :)
3. We have a disconnect at the end of each perl CGI. Not sure if it is
being reached, see no plausible reason why it shouldn't - the code isn't
that complex.
4. This is what we have in httpd.conf:
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options +ExecCGI
5. We easily reach 1024 webserver processes, apache 1.3.
6. We have not verified anything with tracing.
Does this answer all the questions?
On Wed, 2004-12-01 at 17:39 -0500, Perrin Harkins wrote:
> On Wed, 2004-12-01 at 19:00 -0600, Richard N. Fogle wrote:
> > The problem we're having is each time the CGI is called it seems to
> > make a persistent connection to the database despite the fact that we
> > have a $dbh->disconnect(); at the end of the code.
>
> Are you using Apache::DBI anywhere? Make sure. Have you verified that
> the disconnect really gets called? You can turn DBI tracing on to find
> out what's happening. I would suggest that you might be trapping a copy
> of your $dbh in a closure or a global, but that shouldn't matter if you
> actually call disconnect() on it.
>
> > We tried placing the connect strings in startup.PL
>
> Don't do that! Opening database connections before the server forks
> will wreak havoc when multiple processes try to use the same socket.
>
> - Perrin
>
>
--=-k15xBp6T8qH3raJw+nDI
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.2.3">
</HEAD>
<BODY>
Malcom and Perrin,<BR>
<BR>
Thank you for your quick replies! <BR>
<BR>
1. We disabled Apache::DBI - the server can generate thousands of queries per second and this feature literally made the CPU catch fire.<BR>
2. Understood about placing the connect strings in startup.PL. That's why we wrote the list first :)<BR>
3. We have a disconnect at the end of each perl CGI. Not sure if it is being reached, see no plausible reason why it shouldn't - the code isn't that complex.<BR>
4. This is what we have in httpd.conf:<BR>
<FONT COLOR="#800000">SetHandler perl-script </FONT><BR>
<FONT COLOR="#800000">PerlHandler Apache::Registry </FONT><BR>
<FONT COLOR="#800000">PerlSendHeader On </FONT><BR>
<FONT COLOR="#800000">Options +ExecCGI</FONT><BR>
5. We easily reach 1024 webserver processes, apache 1.3.<BR>
6. We have not verified anything with tracing.<BR>
<BR>
Does this answer all the questions?<BR>
<BR>
<BR>
On Wed, 2004-12-01 at 17:39 -0500, Perrin Harkins wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">On Wed, 2004-12-01 at 19:00 -0600, Richard N. Fogle wrote:</FONT>
<FONT COLOR="#000000">> The problem we're having is each time the CGI is called it seems to</FONT>
<FONT COLOR="#000000">> make a persistent connection to the database despite the fact that we</FONT>
<FONT COLOR="#000000">> have a $dbh->disconnect(); at the end of the code.</FONT>
<FONT COLOR="#000000">Are you using Apache::DBI anywhere? Make sure. Have you verified that</FONT>
<FONT COLOR="#000000">the disconnect really gets called? You can turn DBI tracing on to find</FONT>
<FONT COLOR="#000000">out what's happening. I would suggest that you might be trapping a copy</FONT>
<FONT COLOR="#000000">of your $dbh in a closure or a global, but that shouldn't matter if you</FONT>
<FONT COLOR="#000000">actually call disconnect() on it.</FONT>
<FONT COLOR="#000000">> We tried placing the connect strings in startup.PL</FONT>
<FONT COLOR="#000000">Don't do that! Opening database connections before the server forks</FONT>
<FONT COLOR="#000000">will wreak havoc when multiple processes try to use the same socket.</FONT>
<FONT COLOR="#000000">- Perrin</FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-k15xBp6T8qH3raJw+nDI--