Re: PostgreSQL hanging on new connections? - Mailing list pgsql-general

From Craig Ringer
Subject Re: PostgreSQL hanging on new connections?
Date
Msg-id 4CF4C1FB.60600@postnewspapers.com.au
Whole thread Raw
In response to Re: PostgreSQL hanging on new connections?  (Dusan Misic <promisic@gmail.com>)
Responses Re: PostgreSQL hanging on new connections?
List pgsql-general
On 11/30/2010 03:28 PM, Dusan Misic wrote:
>     We're having similar issues on 8.4.[245]... occasionally psql takes
>     anywhere from a few to several dozen seconds to connect. I've been
>     unsuccessfully trying to blame spikes in the OS run queue (we
>     desperately need some connection pooling) but if it's something to
>     do with locks I can't see in pg_locks, that would explain why I
>     haven't been able to figure out what's going on yet....
>     --
>     Sent via pgsql-general mailing list (pgsql-general@postgresql.org
>     <mailto:pgsql-general@postgresql.org>)
>     To make changes to your subscription:
>     http://www.postgresql.org/mailpref/pgsql-general
>
>
> This is normal. PostgreSQL needs to create new server process to handle
> your requested connection.
>
> Then it needs to allocate resources to that new connection. It
> initializes shared memory for that connection. That is the stall you are
> mentioning.

Eh, what?

Forking a backend and attaching to shared memory should *not* take "a
few seconds". On my test machine it takes 100ms to fork psql, connect to
the postmaster, fork a backend, init the backend, authenticate, run a
dummy query and exit psql.

If you're seeing delays like that, your machine is horrifyingly
overloaded or there's something else wrong.

--
Craig Ringer

pgsql-general by date:

Previous
From: AI Rumman
Date:
Subject: Full Text Partial Match at begining
Next
From: Alexander Farber
Date:
Subject: select max()