X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 97ADC3ABFDD for ; Wed, 29 Dec 2004 23:36:18 +0000 (GMT) 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 03652-06 for ; Wed, 29 Dec 2004 23:35:55 +0000 (GMT) Received: from tetra.ehpg.net (tetra.ehpg.net [216.218.206.34]) by svr1.postgresql.org (Postfix) with ESMTP id B8B4E3AC305 for ; Wed, 29 Dec 2004 23:29:24 +0000 (GMT) Received: from ppp-68-122-211-163.dsl.irvnca.pacbell.net ([68.122.211.163] helo=gentoo.homenetwork) by tetra.ehpg.net with esmtpa (Exim 4.42) id 1CjnFp-0007sl-OQ; Wed, 29 Dec 2004 15:29:23 -0800 Subject: Re: too many clients From: "Gavin M. Roy" To: Frank Bax Cc: pgsql-php@postgresql.org In-Reply-To: <5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca> References: <330532b604122908387f7ffde2@mail.gmail.com> <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com> <330532b604122908387f7ffde2@mail.gmail.com> <5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca> Content-Type: text/plain Organization: 800 Pound Gorilla Date: Wed, 29 Dec 2004 15:32:11 -0800 Message-Id: <1104363131.32605.30.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.038 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/6 X-Sequence-Number: 2964 Per your direction, pg_pConnect is great when you have one site dedicated on one box talking to another dedicated PgSQL box. It does not make sense in mass vhosting environments. Using pg_pConnect greatly reduces execution time in an environment where you're not fighting for resources. I use it on a few very high traffic sites without issue, but it is tuned so that there is only 1 persistant connection per apache backend and postgresql will allow the max apache backends, which by default is generally 256. I highly recommend it in such a situation, while I generally do not recommend it in any other. Gavin On Wed, 2004-12-29 at 13:13 -0500, Frank Bax wrote: > At 12:12 PM 12/29/04, Matthew Terenzio wrote: > > > >On Dec 29, 2004, at 11:38 AM, Mitch Pirtle wrote: > > > >>You got a couple solutions, one of which is getting a connection > >>pooler setup between apache(php) and postgres. SQL Relay > >>(sqlrelay.sf.net) could be a common candidate, as I have used it in > >>the past with great results. > > > >Yes, I have taken a look at that before. It might be a good time to try it. > > > >I don't exactly understand the technical difference between pooled > >connections and persistent ones. > > > >pg_pconnect() is grabbing an existing open connection if one is available. > > > >How is a connection pool more efficient in doing something along these lines? > > > Have you read the php docs on persistent connections? > http://www.php.net/manual/en/features.persistent-connections.php > pg_pconnect is sometimes used in situations where it does not make sense. > > As you mentioned, apache uses numerous child process. A persistent > connection can only be reused if the following things are the same: > - same apache child process requests the connection > - same connect string (ie host, database, user are *all* the same) > > If you have a site where there are many databases and/or many users, it is > very easy for apache to retain more persistent connections than your > postgres limit. There are many variables when trying to figure out which > function works better, so simply try it on your own system. If pg_connect > does not add significant overhead, and manages to avoid the problems you > mentioned, then use it instead of pg_pconnect. > > I haven't heard of pooled connections, but can only assume they somehow > overcome the problems with pg_pconnect gets out of control - perhaps the > connections are shared across apache child processes. > > Frank > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org