Re: PostgreSQL hanging on new connections?

From: Dusan Misic <promisic(at)gmail(dot)com>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL hanging on new connections?
Date: 2010-11-30 09:37:53
Message-ID: AANLkTimePUiYXf+Zh-hk8cEuWcVn_1TWa4DVNzfb=WUU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 30, 2010 at 10:20 AM, Craig Ringer
<craig(at)postnewspapers(dot)com(dot)au>wrote:

> 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(at)postgresql(dot)org
>> <mailto:pgsql-general(at)postgresql(dot)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
>

This is not happening to me. Even on my home computer (which is terribly
slow single core Sempron 2600+ with 128 kB of L2 cache, 1.5 GB DDR RAM and
with slow ATA hard disks) it is fast to connect. Maximum (slowest)
connection time is about 500 ms. I did some tuning in postgresql.conf.

I'm very happy with PostgreSQL speed on my 'snail' computer. :)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Florian Weimer 2010-11-30 10:12:47 Re: PostgreSQL hanging on new connections?
Previous Message Alexander Farber 2010-11-30 09:28:36 select max()