From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | John Gateley <gateley(at)jriver(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: DB Connections in TIME_WAIT state |
Date: | 2008-05-13 14:23:48 |
Message-ID: | 24802.1210688628@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
John Gateley <gateley(at)jriver(dot)com> writes:
> Hi, I'm using the Pg perl module to connect to Postgresql 8.1
> via localhost (127.0.0.1) from webscripts. I'm noticing a lot
> of TIME_WAIT socket connections:
> tcp 0 0 127.0.0.1:39291 127.0.0.1:5432 TIME_WAIT
> tcp 0 0 127.0.0.1:60720 127.0.0.1:5432 TIME_WAIT
> tcp 0 0 127.0.0.1:60735 127.0.0.1:5432 TIME_WAIT
> tcp 0 0 127.0.0.1:60769 127.0.0.1:5432 TIME_WAIT
> tcp 0 0 127.0.0.1:39281 127.0.0.1:5432 TIME_WAIT
> ...
This seems like a kernel bug to me. The TCP stack ought to know it
doesn't need any shutdown delay on a local connection.
> I think the number is high enough (200~250) that sometime the
> server runs out of sockets.
Maybe you need to stop using so many connections --- quite aside
from any kernel issues, a database session isn't exactly cheap
to launch. Consider some form of connection pooling.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-05-13 14:26:26 | Re: Making sure \timing is on |
Previous Message | Josh Tolley | 2008-05-13 14:19:42 | Re: Problem returning strings with pgsql 8.3.x |