Re: Built-in connection pooling

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Built-in connection pooling
Date: 2018-04-24 09:09:28
Message-ID: 9b2c78d1-8e1c-f0b5-75fe-530633633de5@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.04.2018 21:56, Robert Haas wrote:
> On Fri, Jan 19, 2018 at 11:59 AM, Tomas Vondra
> <tomas(dot)vondra(at)2ndquadrant(dot)com> wrote:
>> Hmmm, that's unfortunate. I guess you'll have process the startup packet
>> in the main process, before it gets forked. At least partially.
> I'm not keen on a design that would involve doing more stuff in the
> postmaster, because that would increase the chances of the postmaster
> accidentally dying, which is really bad. I've been thinking about the
> idea of having a separate "listener" process that receives
> connections, and that the postmaster can restart if it fails. Or
> there could even be multiple listeners if needed. When the listener
> gets a connection, it hands it off to another process that then "owns"
> that connection.
>
> One problem with this is that the process that's going to take over
> the connection needs to get started by the postmaster, not the
> listener. The listener could signal the postmaster to start it, just
> like we do for background workers, but that might add a bit of
> latency. So what I'm thinking is that the postmaster could maintain
> a small (and configurably-sized) pool of preforked workers. That
> might be worth doing independently, as a way to reduce connection
> startup latency, although somebody would have to test it to see
> whether it really works... a lot of the startup work can't be done
> until we know which database the user wants.
>

I agree that starting separate "listener" process(es) is the most
flexible and scalable solution.
I have not implemented this apporach due to the problems with forking
new backend you have mentioned.
But certainly it can be addressed.

--
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 Pavel Stehule 2018-04-24 09:53:29 Re: [RFC] Add an until-0 loop in psql
Previous Message Kyotaro HORIGUCHI 2018-04-24 09:08:38 Re: using expression syntax for partition bounds