Re: How to keep queries low latency as concurrency increases

From: Marko Kreen <markokr(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, 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-11-05 23:58:07
Message-ID: CACMqXCJzid9BZjMKfK5+UpoacAG_ojegnCigmF_12Pq8DK0bAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Tue, Nov 6, 2012 at 1:31 AM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Mon, Nov 5, 2012 at 2:58 PM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>> On Sun, Nov 4, 2012 at 1:53 AM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
>>> On a 4 CPU machine, if I run pgbench -c10 -j10 with dummy queries
>>> (like "select 1;" or "set timezone...") against 2 instances of
>>> pgbouncer, I get nearly twice the throughput as if I use only one
>>> instance.
>>>
>>> A rather odd workload, maybe, but it does seem to be similar to the
>>> one that started this thread.
>>
>> Every-connection-is-busy is pessimal workload for pgbouncer,
>> as it has nothing useful to contribute to setup, just overhead.
>
> It still has something to contribute if connections are made and
> broken too often (pgbench -C type workload), as seems to be the case
> here.

I did not notice -C in your message above.

In such case, in a practical, non-pgbench workload, you should
move pgbouncer to same machine as app, so any overhead
is just CPU, spread over all app instances, and does not
include network latency.

> If he can get an application-side pooler (or perhaps just a change in
> configuration) such that the connections are not made and broken so
> often, then removing pgbouncer from the loop would probably be a win.

Yes, if app has good pooling, there is less use for pgbouncer.

In any case, only long connections should go over network.

--
marko

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jeff Janes 2012-11-06 01:30:36 Re: How to keep queries low latency as concurrency increases
Previous Message Jeff Janes 2012-11-05 23:31:52 Re: How to keep queries low latency as concurrency increases