Worried about database connection...

From: Date: Sat, 08 Jul 2000 10:26:41 +0000
Subject: Worried about database connection...
Groups: php.db php.general 
Request: Send a blank email to php-db+get-976@lists.php.net to get a copy of this message
Hi all. I'm seriously worried about the load generated by database connection on a site I'm developing... I'm crossposting this mex to general an db list. Please direct me to the correct place where this thread should live and I'll stick to that, thanks! I'm in early developing stage. I set up a box with apache 1.3.12, PHP 4.0.0 (--with-apxs), postgresql 7.0.2. The machine is quite well equipped (1/2 Gig'o'Ram, PIII 500, High end SCSI disks...). The problem is that PHP-enabled pages seem to spawn a large number of database connections, and they don't seem to reuse them efficiently. I'using _pconnect, to reduce latency, and keeping the number of concurrent requests low... and after just a few hours of work, with just two clients using the web site, I've reached the max limit of 32 postgres client! I know that I can increase that limit to much more than 32, and I know that for the way the Http server works even a single user that does many request can need many backend connections, since each request could be served by a different http process. But since there were so few users requesting a connection, why there wasn't an available one? Moreover, the odd thing is that at the moment I start getting the "too many client" error, I had 32 postgres backend running but only 20 http processes! I thought that when a http process gets killed, the connection owned by that process should get closed. Instead, it seems that the postgres backend lives on, and after some time the http process can not find an available one no more. If this is the case, even if I config my box to accept 100, or 200 concurrent requests, they will be used in little time, when I will have the site exposed to the public!!! What should I do? I wouldn't switch to another DB, since PostgreSQL it's the one I know better. Nor I would like to use the "normal" pgsql_connect, as it's far slower. I can't believe that with these tools I will not bee able to set up a high-traffic website!!! Thank you all in advance for any hint, and bye bye from Italy... /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Fabrizio Ermini Alternate E-mail: C.so Umberto, 7 faermini@tin.it loc. Meleto Valdarno Mail on GSM: (keep it short!) 52020 Cavriglia (AR) faermini@sms.tin.it

« previous php.db (#976) next »