[imp] postgresql maxing out

Eric Rostetter eric.rostetter@physics.utexas.edu
Sun Nov 3 04:18:43 PST 2002


Quoting Rick Emery <rick@emery.2y.net>:

> > It seems if you're using php with connection pooling (i.e. pg_pconnect)
> then
> > each apache child spawned will keep open any connection it opens for reuse.
> > So if your child limit in apache is higher than your allowed connections to
> > postgresql, you can run out of postgresql connections...
> >
> Sorry that it's taken me so long to reply to this, especially since you're
> trying to help. My friend and I both switched to MySQL, so I'm not really in
> a position to test this, but I think you may be right on the money.
> 
> If I'm looking in the right place, httpd.conf has "MaxClients 150". This is
> significantly larger than the max 32 connections allowed by my postgresql
> install. If I understand you correctly, setting MaxClients to 31 or below
> would solve the problems I was experiencing.

Yes.  But since then, I've also learned that there are php.ini settings
that controll the number of persistent connections php will establish.

So the answers are:

1) Make sure you have you sql max connections >= your httpd max connections
2) Make sure you set your php.ini settings for max persitent connections
   <= your sql max connections

I still think #1 is best.  Personally though, I would set both.  That way
if in the future you (or someone else) raises the http max connections without
remembering to raise the sql max connections, the php.ini setting will kick
in and save the day...

> Thanks for the info. This is good to know, and maybe the other person that
> was seeing this problem can benefit.

Yes, I hope so.  I'm hoping to add it to the FAQ when I find time.

> Rick

-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

Why get even? Get odd!


More information about the imp mailing list