pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-php@postgresql.org
Subject: Re: too many clients
Date: Wed, 29 Dec 2004 13:13:39 -0500
Message-ID: <5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca> (raw)
In-Reply-To: <C85319E3-59BC-11D9-B3B3-0003938BDF32@localnotion.com>
References: <330532b604122908387f7ffde2@mail.gmail.com>
	<0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com>
	<330532b604122908387f7ffde2@mail.gmail.com>

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 




view thread (15+ messages)  latest in thread

Message-ID: <5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca>
Permalink:  ../5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: fbax@sympatico.ca
  Subject: Re: too many clients
  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> <5.2.1.1.0.20041229125718.00a02520@pop6.sympatico.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox