Re: idle connections

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: idle connections
Дата
Msg-id 4ACA7D70.5050405@pinpointresearch.com
обсуждение исходный текст
Ответ на idle connections  (Aras Angelo <araskoktas@gmail.com>)
Список pgsql-admin
Aras Angelo wrote:
> Hi,
>
> Im seeing lots of idle connections (not idle in transaction) to my
> database server. My front end is written with PHP and i couldnt find
> anything that can cause this. If i do a kill proc-id every few minutes
> on my server via cron, would this effect anything badly?
>
> Thanks
Before you go killing things willy-nilly, try diagnosing the problem -
papering over problems is almost never a good "solution". In fact,
depending on your designs and workloads, this might be a good thing (if
intentional and understood).

Use (as root) "lsof -i :5432" or your favorite equivalent for your OS.

First run it on the database server to verify that the connections are
from your webserver. If so, run it on your webserver and verify that the
processes are what you think they are.

If PHP (which will probably show up as an Apache or whatever webserver
you are running process), you may have one or more scripts opening
persistent connections. Or a bug. I've seen PHP scripts hang leaving an
open connection to the database. Or it could be a persistent connection
opened by a Perl/Python/Ruby/whatever-else-you-have program so you may
have to check those as well. Perhaps look at the connection start time
in PG and try to correlate it with a request in your webserver log.

I assume you would have told us if you are running pgbouncer or similar
pooling solution as that would be an obvious cause.

Cheers,
Steve



В списке pgsql-admin по дате отправления:

Предыдущее
От: u235sentinel
Дата:
Сообщение: compiling postgres with static libraries?
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: idle connections