Re: How to keep queries low latency as concurrency increases - Mailing list pgsql-performance

From Merlin Moncure
Subject Re: How to keep queries low latency as concurrency increases
Date
Msg-id CAHyXU0w-DNb9sUD7c3DQpk-zNjt5wtuTHjDVmNwXVuZow6TYBg@mail.gmail.com
Whole thread Raw
In response to Re: How to keep queries low latency as concurrency increases  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: How to keep queries low latency as concurrency increases  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-performance
On Tue, Oct 30, 2012 at 4:58 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> On Mon, Oct 29, 2012 at 5:11 PM, Catalin Iacob <iacobcatalin@gmail.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


pgsql-performance by date:

Previous
From: Jeff Janes
Date:
Subject: Re: How to keep queries low latency as concurrency increases
Next
From: Dong Ye
Date:
Subject: dbt2 performance regresses from 9.1.6 to 9.2.1