pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mitch Pirtle <mitch.pirtle@gmail.com>
To: Matthew Terenzio <webmaster@localnotion.com>
Cc: pgsql-php@postgresql.org
Subject: Re: too many clients
Date: Wed, 29 Dec 2004 11:38:22 -0500
Message-ID: <330532b604122908387f7ffde2@mail.gmail.com> (raw)
In-Reply-To: <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com>
References: <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com>

Mey Matt,

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.

Another option could be to implement caching on the webserver of
common, static data, by using either a database abstraction library
such as ADOdb (adodb.sf.net) that can cache queries, or to implement a
RAM-based caching solution such as memcached
(www.danga.com/memcached).

Some people tell me that persistent connections are actually bad, and
to always use pg_connect.  I cannot vouch for this approach, but you
might want to try it to see if it helps you in your particular
situation.

I'm rolling out a site that gets >5M page views daily in a couple
weeks, so this should be a good opportunity to get some detailed
real-world performance metrics.

- Mitch

On Wed, 29 Dec 2004 10:05:18 -0500, Matthew Terenzio
<webmaster@localnotion.com> wrote:
> After years of running apache-php-postgres with no issues, I'm suddenly
> receiving the cannot connect to postgres - too many clients already
> error on my script pages.
> 
> 1. Does everyone ALWAYS have Apache max connections lower than postgres
> max clients? I tried this but the problem still returned.
> 
> 2.I'm using pg_pconnect().
> 
> 3. Traffic is slightly higher lately but not that high.
> 
> 4. I'm thinking about apache changing apache maxrequestsperchild from 0
> to maybe 10 or something to periodically kill apache children, but I
> can't see why the maxclients in apache would overload postgres if they
> are both the same number. It is hard fro me to believe there are
> actually that many simultaneous users of this system, so for some
> reason the connections are remaining open and unused.
> 
> Any wisdom out there?
> 
> Matt
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>



view thread (15+ messages)  latest in thread

Message-ID: <330532b604122908387f7ffde2@mail.gmail.com>
Permalink:  ../330532b604122908387f7ffde2@mail.gmail.com/
Also on:    postgresql.org/message-id/330532b604122908387f7ffde2@mail.gmail.com

 · 

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: mitch.pirtle@gmail.com, webmaster@localnotion.com
  Subject: Re: too many clients
  In-Reply-To: <330532b604122908387f7ffde2@mail.gmail.com>
  References: <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com> <330532b604122908387f7ffde2@mail.gmail.com>

* 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