Re: how to close idle connection created with php's pg_pconnect() - Mailing list pgsql-general

From GH
Subject Re: how to close idle connection created with php's pg_pconnect()
Date
Msg-id 20010506124838.C55594@over-yonder.net
Whole thread Raw
In response to how to close idle connection created with php's pg_pconnect()  ("Torsten Krämer" <tk@kreakom.de>)
List pgsql-general
On Mon, Apr 30, 2001 at 03:28:06PM +0200, some SMTP stream spewed forth:
> hallo,
>
> i am using php with postgres and using open a persistent connection.
>
> But the limit on open connection is reached very fast, because the idle
> connection aren't close.

That is the idea behind persistent connections. If the idle connections
were closed, they wouln't very well be persistent, eh?

> My question:
> How can idle connection automatically closed ?

If this is a problem, some would say that you shouldn't be using
persistent connections or that you should raise the maximum number
of backends. If I recall correctly, the backends do not "time out", so
you have to adjust the Apache config directives to have/allow the httpd
processes to die and consequently kill the PostgreSQL processes.

Maximum PostgreSQL processes must be greater than the number of unique
accounts connecting times the MaxClients (in httpd.conf).

max(postgres)==(unique accounts)(MaxClients)

If you have 3 different accounts connecting up to MaxClients=10 times,
then the max number of PostgreSQL processes must be equal to or greater
than 30. You see, the number of backends needed to support persistent
connections grows rapidly. Think most about the number of *simultaneous*
connections you need to support---that should be MaxClients. If your
machine cannot handle backends for that many connections, you should
switch to non-persistent connections or to a bigger machine.


There is a backend for each account for each Apache process.


Cheers,
gh


> thanks
>
> Torsten Krämer

pgsql-general by date:

Previous
From: "Mitch Vincent"
Date:
Subject: Re: Sessions, Connections ...
Next
From: "Muhammad Rusydi"
Date:
Subject: Re: nested if , and how to trigger....