Re: Built-in connection pooler

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Dimitri Fontaine <dim(at)tapoueh(dot)org>
Subject: Re: Built-in connection pooler
Date: 2019-01-29 09:09:50
Message-ID: ca90d2cc-6fbf-e9fa-19b9-b4456bbabdff@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 29.01.2019 0:10, Bruce Momjian wrote:
> On Thu, Jan 24, 2019 at 08:14:41PM +0300, Konstantin Knizhnik wrote:
>> The main differences with pgbouncer&K are that:
>>
>> 1. It is embedded and requires no extra steps for installation and
>> configurations.
>> 2. It is not single threaded (no bottleneck)
>> 3. It supports all clients (if client needs session semantic, then it will be
>> implicitly given dedicated backend)
>>
>>
>> Some performance results (pgbench -S -n):
>>
>> ┌────────────────┬────────┬─────────────┬─────────┬─────────────────────────┐
>> │ #Connections │ Proxy │ Proxy/SSL │ Direct │ Direct/SSL │
>> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤
>> │ 1 │ 13752 │ 12396 │ 17443 │ 15762 │
>> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤
>> │ 10 │ 53415 │ 59615 │ 68334 │ 85885 │
>> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤
>> │ 1000 │ 60152 │ 20445 │ 60003 │ 24047 │
>> └────────────────┴────────┴─────────────┴─────────┴──────────────┘
> It is nice it is a smaller patch. Please remind me of the performance
> advantages of this patch.
>
The primary purpose of pooler is efficient support of large number of
connections and minimizing system resource usage.
But as far as Postgres is not scaling well at SMP system with larger
number of CPU cores (due to many reasons discussed in hackers)
reducing number of concurrently working backends can also significantly
increase performance.

I have not done such testing yet but I am planing to do it as well as
comparison with pgbouncer and Odyssey.
But please notice that this proxy approach is by design slower than my
previous implementation used in PgPRO-EE (based on socket redirection).
At some workloads connections throughout proxy cause up to two times
decrease of performance comparing with dedicated backends.
There is no such problem with old connection pooler implementation which
was always not worser than vanilla. But it doesn't support SSL connections
and requires much more changes in Postgres core.

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Konstantin Knizhnik 2019-01-29 09:21:33 Re: Built-in connection pooler
Previous Message Takashi Menjo 2019-01-29 08:46:07 RE: static global variable openLogOff in xlog.c seems no longer used