X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 601CDD9741 for ; Mon, 21 Nov 2005 04:58:49 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87147-06 for ; Mon, 21 Nov 2005 08:58:49 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 596CBD977D for ; Mon, 21 Nov 2005 04:58:46 -0400 (AST) Received: from mail1.catalyst.net.nz (godel.catalyst.net.nz [202.78.240.40]) by svr2.postgresql.org (Postfix) with ESMTP id 84D16F0BE7 for ; Mon, 21 Nov 2005 08:58:47 +0000 (GMT) Received: from 218-101-8-114.xtreme.net.nz ([218.101.8.114] helo=ubu.mcmillan.net.nz) by mail1.catalyst.net.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1Ee7Va-0007dR-3Z; Mon, 21 Nov 2005 21:58:42 +1300 Received: by ubu.mcmillan.net.nz (Postfix, from userid 1000) id DBFAB6F0491; Mon, 21 Nov 2005 21:58:40 +1300 (NZDT) Subject: Re: Unwanted persisting connections From: Andrew McMillan To: Gary Hoffman Cc: pgsql-php@postgresql.org In-Reply-To: References: <3DF94EB5-4391-4709-9695-B544F77C5596@myrealbox.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-ZQdnxV9V3hwTkcnI7/T6" Organization: Catalyst .Net Ltd Date: Mon, 21 Nov 2005 21:58:40 +1300 Message-Id: <1132563520.5795.4.camel@ubu.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/16 X-Sequence-Number: 3333 --=-ZQdnxV9V3hwTkcnI7/T6 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2005-11-20 at 20:06 -0800, Gary Hoffman wrote: > I've run PHP and PostgreSQL for quite a while and never seen this problem > before. I think it's new, but maybe I never paid attention to it before. >=20 > I am frequently running out of connections to the database. Here's a > snippet of my ps -ax >=20 > 1882 ?? S 0:00.07 postgres: postgres cgssd_members [local] idle = =20 > =20 > 1883 ?? S 0:00.09 postgres: postgres cgssd_members [local] idle = =20 > =20 > 1884 ?? S 0:00.07 postgres: postgres cgssd_members [local] idle = =20 > =20 > 1886 ?? S 0:00.14 postgres: postgres cgssd_members [local] idle = =20 > =20 > 1887 ?? S 0:00.06 postgres: postgres cgssd_members [local] idle = =20 > =20 > 500 std- S 0:01.14 /usr/local/bin/postmaster -D > /usr/local/pgsql/data > 501 std- S 0:00.02 postgres: stats buffer process = =20 > =20 > 502 std- S 0:00.21 postgres: stats collector process = =20 > =20 >=20 > As you can see, there are some idle connections that have come in from PH= P > on my web pages. I've never seen these before and eventually they build u= p > and I get an error connecting from the PHP page to the database. >=20 > I'm running Apache 1.3.33 on Darwin Kernal 7.9.0 (MacOS X 10.3.9) with PH= P > 4.3.6 and PostgreSQL 7.4.2. You will have as many of these as you have apache processes. That's what persistent connections means! If you have MaxClients set to (e.g.) 150 in your Apache configuration, and you actually get to something like that, then the default PostgreSQL configuration of 100 clients simply won't be enough. You should increase it to at leas 20-50 more than the MaxClients setting that Apache has. You'll be pleased to know that each extra PostgreSQL connection typically uses less than each additional Apache connection (especially when you're running PHP et al.) so if you find yourself running out of RAM you will need to lower the MaxClients setting first. Regards, Andrew McMillan. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267 You will be a winner today. Pick a fight with a four-year-old. ------------------------------------------------------------------------- --=-ZQdnxV9V3hwTkcnI7/T6 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDgYxAjJA0f48GgBIRAu4QAJwNBZ00eD6DAw8eSUtih6YAhkTAwgCguwRh ZpGziUuFV+gGpGEVsQz/6dE= =6PR6 -----END PGP SIGNATURE----- --=-ZQdnxV9V3hwTkcnI7/T6--