Re: too many idle processes

From: Scott Marlowe <scott(dot)marlowe(at)ihs(dot)com>
To: Soon-Son Kwon <kss(at)kldp(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: too many idle processes
Date: 2002-05-21 15:36:34
Message-ID: Pine.LNX.4.33.0205210924180.1620-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 21 May 2002, Soon-Son Kwon wrote:

> Hello: I am running pgsql on debian GNU/Linux woody box
> to run "sourceforge" program. (http://www.freesoftware.fsf.org/debian-sf/)
>
> Here is part of the /etc/postgresql/postgresql.conf:
>
> ---
> debug_level = 0
> log_connections = on
> log_pid = on
> log_timestamp = on
> syslog = 2
> # if syslog is 0, turn silent_mode off!
> silent_mode = off
> syslog_facility = LOCAL0
> trace_notify = off

This setting here:

> max_connections = 64

tells postgresql how many connections it can accept max.

In Apache's httpd.conf file, the line

MaxClients 90

says how many clients the web server can accept connections from. This is
the maximum number of "child processes" apache will spawn.

In php.ini we find the lines:

pgsql.allow_persistent = On
pgsql.max_persistent = 2 #max persistant links per process
pgsql.max_links = 16 # max pers/non-pers links per process

We need to make sure that PHP/Apache don't try to open more than
postgresql is configured for.

You probably should increase the max_connections setting in
postgresql.conf first, to at least 128 or 256.

then, you need to set MaxClients * pgsql.max_persistant to be <
max_connections. Be sure and leave one or two spare connects for you to
be able to get via a psql command line.

note that if you are running >1 web server against one database server,
you then have to have num_web_servers * MaxClients * pgsql.max_persistant
< max_connections.

This is a common problem with persistant connections, and the method for
setting up a web server to handle persistant connects with php/apache is
non-obvious. but it does work.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Olonichev Sergei 2002-05-21 15:53:48 Re: data addition speed or how to fast add data?
Previous Message Stephan Szabo 2002-05-21 14:54:29 Re: Mysterious locking problem