Re: DBI persistence problem

[prev] [thread] [next] [Date index for 2004/12/02]

From: Richard N. Fogle
Subject: Re: DBI persistence problem
Date: 01:26 on 02 Dec 2004
--=-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.&nbsp; We disabled Apache::DBI - the server can generate thousands of queries per second and this feature literally made the CPU catch fire.<BR>
2.&nbsp; Understood about placing the connect strings in startup.PL.&nbsp; That's why we wrote the list first :)<BR>
3.&nbsp; We have a disconnect at the end of each perl CGI.&nbsp; Not sure if it is being reached, see no plausible reason why it shouldn't - the code isn't that complex.<BR>
4.&nbsp; 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.&nbsp; We easily reach 1024 webserver processes, apache 1.3.<BR>
6.&nbsp; 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">&gt; The problem we're having is each time the CGI is called it seems to</FONT>
<FONT COLOR="#000000">&gt; make a persistent connection to the database despite the fact that we</FONT>
<FONT COLOR="#000000">&gt; have a $dbh-&gt;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">&gt; 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--

DBI persistence problem
Richard N. Fogle 01:00 on 02 Dec 2004

Re: DBI persistence problem
Malcolm J Harwood 22:36 on 01 Dec 2004

Re: DBI persistence problem
Perrin Harkins 22:39 on 01 Dec 2004

Re: DBI persistence problem
Richard N. Fogle 01:26 on 02 Dec 2004

Re: DBI persistence problem
Malcolm J Harwood 23:10 on 01 Dec 2004

Re: DBI persistence problem
Richard N. Fogle 23:48 on 01 Dec 2004

Re: DBI persistence problem
Perrin Harkins 19:16 on 02 Dec 2004

Re: DBI persistence problem
Rob Mueller 19:46 on 02 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52