Re: How to keep queries low latency as concurrency increases

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Catalin Iacob <iacobcatalin(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: How to keep queries low latency as concurrency increases
Date: 2012-10-31 18:39:53
Message-ID: CAHyXU0w-DNb9sUD7c3DQpk-zNjt5wtuTHjDVmNwXVuZow6TYBg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Oct 30, 2012 at 4:58 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Mon, Oct 29, 2012 at 5:11 PM, Catalin Iacob <iacobcatalin(at)gmail(dot)com> wrote:
>
>> pgbouncer 1.4.2 installed from Ubuntu's packages on the same machine
>> as Postgres. Django connects via TCP/IP to pgbouncer (it does one
>> connection and one transaction per request) and pgbouncer keeps
>> connections open to Postgres via Unix socket.
>
> Isn't pgbouncer single-threaded?
>
> If you hitting it with tiny queries as fast as possible from 20
> connections, I would think that it would become the bottleneck.

Single threaded asynchronous servers are known to scale better for
this type of workload than multi-threaded systems because you don't
have to do locking and context switching. By 'for this type of
workload', I mean workloads where most of the real work done is i/o --
pgbouncer as it's just routing data between network sockets is
basically a textbook case for single threaded server.

stunnel, by comparison, which has non-triival amounts of non i/o work
going on, is more suited for threads. It also has severe scaling
limits relative to pgbouncer.

pgbouncer is an absolute marvel and should be standard kit in any case
you're concerned about server scaling in terms of number of active
connections to the database. I'm in the camp that application side
connection pools are junk and should be avoided when possible.

merlin

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Dong Ye 2012-10-31 22:48:44 dbt2 performance regresses from 9.1.6 to 9.2.1
Previous Message Jeff Janes 2012-10-31 16:45:25 Re: How to keep queries low latency as concurrency increases