On Apr 22, 2008, at 10:31 AM, Bryan Buecking wrote:
> Hi,
>
> I'm running into an performance problem where a Postgres db is running
> at 99% CPU (4 cores) with about 500 concurrent connection doing=20=20
> various
> queries from a web application. This problem started about a week ago,
> and has been steadily going downhill. I have been tweaking the=20=20
> config a
> bit, mainly shared_memory but have seen no noticeable improvements.
>
> at any given time there is about 5-6 postgres in startup
> (ps auxwww | grep postgres | grep startup | wc -l)
>
> about 2300 connections in idle
> (ps auxwww | grep postgres | idle)
>
> and loads of "FATAL: sorry, too many clients already" being logged.
>
> The server that connects to the db is an apache server using=20=20
> persistent
> connections. MaxClients is 2048 thus the high number of connections
> needed. Application was written in PHP using the Pear DB class.
Are you referring to PHP's persistent connections? Do not use
those.=20=20=
=20
Here's a thread that details the issues with why not:
http://archives.post=
gresql.org/pgsql-general/2007-08/msg00660.php=20
.. Basically, PHP's persistent connections are NOT pooling
solution.=20=20=
=20
Us pgpool or somesuch.
<snip>
>
> max_connections =3D 2400
That is WAY too high. Get a real pooler, such as pgpool, and drop=20=20
that down to 1000 and test from there. I see you mentioned 500=20=20
concurrent connections. Are each of those connections actually
doing=20=20
something? My guess that once you cut down on the number actual=20=20
connections you'll find that each connection can get it's work done=20=20
faster and you'll see that number drop significantly. For example,=20=20
our application does anywhere from 200 - 600 transactions per
second,=20=20
dependent on the time of day/week, and we never need more that 150
to=20=20
200 connections (although we do have the max_connections set to 500).
<snip>
Erik Jones
DBA | Emma=AE
erik@[EMAIL PROTECTED]
or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
--=20
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


|