Re: Built-in connection pooler

2022-01-13 Thread Li Japin
lto:knizh...@garret.ru>> wrote: People asked me to resubmit built-in connection pooler patch to commitfest. Rebased version of connection pooler is attached. Hi, hackers Does the PostgreSQL core do not interested in the built-in connection pool? If so, could somebody tell me why we do not need

Re: Built-in connection pooler

2021-04-28 Thread Antonin Houska
Konstantin Knizhnik wrote: > People asked me to resubmit built-in connection pooler patch to commitfest. > Rebased version of connection pooler is attached. I've reviewd the patch but haven't read the entire thread thoroughly. I hope that I don't duplicate many comments posted earlier by

Re: Built-in connection pooler

2021-03-22 Thread Konstantin Knizhnik
Hi, Thank you for review! On 21.03.2021 23:59, Zhihong Yu wrote: Hi, +          With load-balancing policy postmaster choose proxy with lowest load average. +          Load average of proxy is estimated by number of clients connection assigned to this proxy with extra weight for SSL

Re: Built-in connection pooler

2021-03-21 Thread Zhihong Yu
Use then for launching pooler worker backends and report error Not sure I understand the above sentence. Did you mean 'them' instead of 'then' ? Cheers On Sun, Mar 21, 2021 at 11:32 AM Konstantin Knizhnik wrote: > People asked me to resubmit built-in connection pooler patch to commitfest. >

Re: Built-in connection pooler

2021-03-21 Thread Konstantin Knizhnik
People asked me to resubmit built-in connection pooler patch to commitfest. Rebased version of connection pooler is attached. diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index 6fbfef2b12..27aa6cba8e 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -11,6 +11,7

Re: Built-in connection pooler

2020-09-17 Thread Daniel Gustafsson
> On 17 Sep 2020, at 10:40, Konstantin Knizhnik > wrote: > 1. Should I myself change status from WfA to some other? Yes, when you've addressed any issues raised and posted a new version it's very helpful to the CFM and the community if you update the status. > 2. Is there some way to receive

Re: Built-in connection pooler

2020-09-17 Thread Konstantin Knizhnik
stallation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provid

Re: Built-in connection pooler

2020-09-16 Thread Michael Paquier
On Thu, Jul 02, 2020 at 06:38:02PM +0300, Konstantin Knizhnik wrote: > Sorry, correct patch is attached. This needs again a rebase, and has been waiting on author for 6 weeks now, so I am switching it to RwF. -- Michael signature.asc Description: PGP signature

Re: Built-in connection pooler

2020-07-05 Thread Konstantin Knizhnik
Thank your for your help. On 05.07.2020 07:17, Jaime Casanova wrote: You should also allow cursors without the WITH HOLD option or there is something i'm missing? Yes, good point. a few questions about tainted backends: - why the use of check_primary_key() and check_foreign_key() in

Re: Built-in connection pooler

2020-07-04 Thread Jaime Casanova
On Wed, 7 Aug 2019 at 02:49, Konstantin Knizhnik wrote: > > Hi, Li > > Thank you very much for reporting the problem. > > On 07.08.2019 7:21, Li Japin wrote: > > I inspect the code, and find the following code in DefineRelation function: > > > > if (stmt->relation->relpersistence !=

Re: Built-in connection pooler

2020-07-02 Thread Konstantin Knizhnik
J2EE, and odyssey. Using an external connection pooler requires additional efforts for installation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances

Re: Built-in connection pooler

2020-07-02 Thread Daniel Gustafsson
> On 2 Jul 2020, at 13:33, Konstantin Knizhnik > wrote: > On 01.07.2020 12:30, Daniel Gustafsson wrote: >>> On 24 Mar 2020, at 17:24, Konstantin Knizhnik >>> wrote: >>> Rebased version of the patch is attached. >> And this patch also fails to apply now, can you please submit a new version? >>

Re: Built-in connection pooler

2020-07-02 Thread Konstantin Knizhnik
hreaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connect

Re: Built-in connection pooler

2020-07-01 Thread Daniel Gustafsson
> On 24 Mar 2020, at 17:24, Konstantin Knizhnik > wrote: > Rebased version of the patch is attached. And this patch also fails to apply now, can you please submit a new version? Marking the entry as Waiting on Author in the meantime. cheers ./daniel

Re: Built-in connection pooler

2020-03-24 Thread Konstantin Knizhnik
pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter d

Re: Built-in connection pooler

2020-03-24 Thread David Steele
Hi Konstantin, On 11/14/19 2:06 AM, Konstantin Knizhnik wrote: Attached please find rebased patch with this bug fixed. This patch no longer applies: http://cfbot.cputube.org/patch_27_2067.log CF entry has been updated to Waiting on Author. Regards, -- -David da...@pgmasters.net

Re: Built-in connection pooler

2019-11-13 Thread Konstantin Knizhnik
or installation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + + Starting with version 12 PostgreSQL pro

RE: Built-in connection pooler

2019-11-13 Thread ideriha.take...@fujitsu.com
Hi >From: Konstantin Knizhnik [mailto:k.knizh...@postgrespro.ru] >>> From: Konstantin Knizhnik [mailto:k.knizh...@postgrespro.ru] >>> >>> New version of builtin connection pooler fixing handling messages of >>> extended protocol. >>> >> 2. When proxy_port is a bit large (perhaps more than 2^15),

Re: Built-in connection pooler

2019-11-12 Thread Konstantin Knizhnik
ular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architectur

RE: Built-in connection pooler

2019-11-11 Thread ideriha.take...@fujitsu.com
Hi. >From: Konstantin Knizhnik [mailto:k.knizh...@postgrespro.ru] > >New version of builtin connection pooler fixing handling messages of extended >protocol. > Here are things I've noticed. 1. Is adding guc to postgresql.conf.sample useful for users? 2. When proxy_port is a bit large (perhaps

Re: Built-in connection pooler

2019-09-27 Thread Konstantin Knizhnik
. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. + This chapte

Re: Built-in connection pooler

2019-09-26 Thread Konstantin Knizhnik
oler requires additional efforts for installation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +

Re: Built-in connection pooler

2019-09-25 Thread Alvaro Herrera
Travis complains that the SGML docs are broken. Please fix. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: Built-in connection pooler

2019-09-11 Thread Konstantin Knizhnik
ck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Work

Re: Built-in connection pooler

2019-09-09 Thread Konstantin Knizhnik
ostgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. + This chapter describes architecture and usage of built-in connectio

Re: Built-in connection pooler

2019-09-06 Thread Konstantin Knizhnik
some kind of connection pooling, such as +pgbouncer, J2EE, and odyssey. Using an external connection pooler requires additional efforts for installation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is + single-threaded and so ca

Re: Built-in connection pooler

2019-08-15 Thread Konstantin Knizhnik
so pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. + This

Re: Built-in connection pooler

2019-08-13 Thread Konstantin Knizhnik
ncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + +Built-in connection pooler spawns one or more proxy

Re: Built-in connection pooler

2019-08-07 Thread Ryan Lambert
> I attached to this mail patch which is fixing both problems: correctly > reports error to the client and calculates number of idle clients). > Yes, this works much better with max_sessions=1000. Now it's handling the 300 connections on the small server. n_idle_clients now looks accurate

Re: Built-in connection pooler

2019-08-07 Thread Ryan Lambert
> First of all default value of this parameter is 1000, not 10. Oops, my bad! Sorry about that, I'm not sure how I got that in my head last night but I see how that would make it act strange now. I'll adjust my notes before re-testing. :) Thanks, *Ryan Lambert* On Wed, Aug 7, 2019 at 4:57

Re: Built-in connection pooler

2019-08-07 Thread Konstantin Knizhnik
Hi, Li Thank you very much for reporting the problem. On 07.08.2019 7:21, Li Japin wrote: I inspect the code, and find the following code in DefineRelation function: if (stmt->relation->relpersistence != RELPERSISTENCE_TEMP     && stmt->oncommit != ONCOMMIT_DROP)    

Re: Built-in connection pooler

2019-08-06 Thread Li Japin
Hi, Konstantin I test the patch-16 on postgresql master branch, and I find the temporary table cannot removed when we re-connect to it. Here is my test: japin@ww-it:~/WwIT/postgresql/Debug/connpool$ initdb The files belonging to this database system will be owned by user "japin". This user must

Re: Built-in connection pooler

2019-08-06 Thread Ryan Lambert
Hi Konstantin, I did some testing with the latest patch [1] on a small local VM with 1 CPU and 2GB RAM with the intention of exploring pg_pooler_state(). Configuration: idle_pool_worker_timeout = 0 (default) connection_proxies = 2 max_sessions = 10 (default) max_connections = 1000 Initialized

Re: Built-in connection pooler

2019-08-02 Thread Konstantin Knizhnik
uncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + + Built-in connection pooler spawns one or

Re: Built-in connection pooler

2019-07-31 Thread Konstantin Knizhnik
ection pooler for Postgres) is +single-threaded and so can a be bottleneck on high load systems, so multiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of

Re: Built-in connection pooler

2019-07-30 Thread Tomas Vondra
On Tue, Jul 30, 2019 at 01:01:48PM +0300, Konstantin Knizhnik wrote: On 30.07.2019 4:02, Tomas Vondra wrote: My idea (sorry if it wasn't too clear) was that we might handle some cases more gracefully. For example, if we only switch between transactions, we don't quite care about 'SET LOCAL'

Re: Built-in connection pooler

2019-07-30 Thread Konstantin Knizhnik
) and at the same time tries to establish new connection. As far as built-in connection pooler performs transaction level scheduling, first session is grabbing backend until end of transaction. So until this transaction is completed backend will not be able to process some other transaction or accept

Re: Built-in connection pooler

2019-07-30 Thread Konstantin Knizhnik
ultiple instances of pgbouncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. + This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + +Built-in connection pooler spawns

Re: Built-in connection pooler

2019-07-29 Thread Tomas Vondra
completely agree with you. My original motivation of implementation of built-in connection pooler was to be able to preserve session semantic (prepared statements, GUCs, temporary tables) for pooled connections. Almost all production system have to use some kind of pooling. But in case of using pgbouncer

Re: Built-in connection pooler

2019-07-29 Thread Konstantin Knizhnik
have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + + Built-in connection pooler spawns one or more p

Re: Built-in connection pooler

2019-07-29 Thread Konstantin Knizhnik
leverage it too. There are use cases that don't work with a built-in connection pool (say, PAUSE/RESUME in pgbouncer allows restarting the database) so projects like pgbouncer or odyssey are unlikely to disappear anytime soon. Obviously built-in connection pooler will never completely substitute

Re: Built-in connection pooler

2019-07-27 Thread Thomas Munro
On Tue, Jul 16, 2019 at 2:04 AM Konstantin Knizhnik wrote: > I have committed patch which emulates epoll EPOLLET flag and so should > avoid busy loop with poll(). > I will be pleased if you can check it at FreeBSD box. I tried your v12 patch and it gets stuck in a busy loop during make check.

Re: Built-in connection pooler

2019-07-27 Thread Dave Cramer
Responses inline. I just picked up this thread so please bear with me. On Fri, 26 Jul 2019 at 16:24, Tomas Vondra wrote: > Hi Konstantin, > > I've started reviewing this patch and experimenting with it, so let me > share some initial thoughts. > > > 1) not handling session state (yet) > > I

Re: Built-in connection pooler

2019-07-26 Thread Tomas Vondra
Hi Konstantin, I've started reviewing this patch and experimenting with it, so let me share some initial thoughts. 1) not handling session state (yet) I understand handling session state would mean additional complexity, so I'm OK with not having it in v1. That being said, I think this is the

Re: Built-in connection pooler

2019-07-26 Thread Konstantin Knizhnik
uncer have to be launched. + + + +Starting with version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + + Built-in connection pooler spawns one or more proxy

Re: Built-in connection pooler

2019-07-26 Thread Ryan Lambert
> I attached new version of the patch with fixed indentation problems and > Win32 specific fixes. Great, this latest patch applies cleanly to master. installcheck world still passes. > "connections_proxies" is used mostly to toggle connection pooling. > Using more than 1 proxy is be needed only

Re: Built-in connection pooler

2019-07-25 Thread Konstantin Knizhnik
ooler requires additional efforts for installation, +configuration and maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can be bottleneck for highload system, so multiple instances of pgbouncer have to be launched. + + + +S

Re: Built-in connection pooler

2019-07-24 Thread Ryan Lambert
Hello Konstantin, > Concerning testing: I do not think that connection pooler needs some kind of special tests. > The idea of built-in connection pooler is that it should be able to handle all requests normal postgres can do. > I have added to regression tests extra path with enabled c

Re: Built-in connection pooler

2019-07-19 Thread Konstantin Knizhnik
tionality to warrant some sort of tests, but I don't know exactly what those would/should be. Thank you once again for this fixes. Updated patch is attached. Concerning testing: I do not think that connection pooler needs some kind of special tests. The idea of built-in connection pooler i

Re: Built-in connection pooler

2019-07-18 Thread Ryan Lambert
Here's what I found tonight in your latest patch (9). The output from git apply is better, fewer whitespace errors, but still getting the following. Ubuntu 18.04 if that helps. git apply -p1 < builtin_connection_proxy-9.patch :79: tab in indent. Each proxy launches its own

Re: Built-in connection pooler

2019-07-18 Thread Ryan Lambert
> I have fixed all reported issues except one related with "dropdb --force" > discussion. > As far as this patch is not yet committed, I can not rely on it yet. > Certainly I can just remove this sentence from documentation, assuming > that this patch will be committed soon. > But then some extra

Re: Built-in connection pooler

2019-07-18 Thread Konstantin Knizhnik
nd maintenance. Also pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can be bottleneck for highload system, so multiple instances of pgbouncer have to be launched. + + + +Starting from version 12 PostgreSQL provides built-in connection pooler. + Thi

Re: Built-in connection pooler

2019-07-17 Thread Ryan Lambert
Hi Konstantin, Thanks for your work on this. I'll try to do more testing in the next few days, here's what I have so far. make installcheck-world: passed The v8 patch [1] applies, though I get indent and whitespace errors: :79: tab in indent. "Each proxy launches its own

Re: Built-in connection pooler

2019-07-16 Thread Konstantin Knizhnik
so pgbouncer (the most popular connection pooler for Postgres) is +single-threaded and so can be bottleneck for highload system, so multiple instances of pgbouncer have to be launched. + + + +Starting from version 12 PostgreSQL provides built-in connection pooler. +This chapter de

Re: Built-in connection pooler

2019-07-15 Thread Konstantin Knizhnik
system, so multiple instances of pgbouncer have to be launched. + + + +Starting from version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + +Built-i

Re: Built-in connection pooler

2019-07-15 Thread Konstantin Knizhnik
On 15.07.2019 1:48, Thomas Munro wrote: On Mon, Jul 15, 2019 at 7:56 AM Konstantin Knizhnik wrote: Can you please explain me more precisely how to reproduce the problem (how to configure postgres and how to connect to it)? Maybe it's just that postmaster.c's ConnCreate() always allocates a

Re: Built-in connection pooler

2019-07-14 Thread Thomas Munro
On Mon, Jul 15, 2019 at 7:56 AM Konstantin Knizhnik wrote: > Can you please explain me more precisely how to reproduce the problem > (how to configure postgres and how to connect to it)? Maybe it's just that postmaster.c's ConnCreate() always allocates a struct for port->gss if the feature is

Re: Built-in connection pooler

2019-07-14 Thread Konstantin Knizhnik
On 14.07.2019 8:03, Thomas Munro wrote: On Tue, Jul 9, 2019 at 8:30 AM Konstantin Knizhnik wrote: Rebased version of the patch is attached. Thanks for including nice documentation in the patch, which gives a good overview of what's going on. I haven't read any code yet, but I took it for

Re: Built-in connection pooler

2019-07-13 Thread Thomas Munro
On Tue, Jul 9, 2019 at 8:30 AM Konstantin Knizhnik wrote: Rebased version of the patch is attached. Thanks for including nice documentation in the patch, which gives a good overview of what's going on. I haven't read any code yet, but I took it for a quick drive to understand the user

Re: Built-in connection pooler

2019-07-08 Thread Konstantin Knizhnik
. + + + +Starting from version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Built-in Connection Pooler Works + + +Built-in connection pooler spawns one or more proxy processes whic

Re: Built-in connection pooler

2019-07-07 Thread Thomas Munro
On Tue, Jul 2, 2019 at 3:11 AM Konstantin Knizhnik wrote: > On 01.07.2019 12:57, Thomas Munro wrote: > > Interesting work. No longer applies -- please rebase. > > > Rebased version of the patch is attached. > Also all this version of built-ni proxy can be found in conn_proxy > branch of

Re: Built-in connection pooler

2019-07-01 Thread Konstantin Knizhnik
eaded and so can be bottleneck for highload system, so multiple instances of pgbouncer have to be launched. + + + +Starting from version 12 PostgreSQL provides built-in connection pooler. +This chapter describes architecture and usage of built-in connection pooler. + + + + How Bu

Re: Built-in connection pooler

2019-07-01 Thread Thomas Munro
On Thu, Mar 21, 2019 at 4:33 AM Konstantin Knizhnik wrote: > New version of the patch (rebased + bug fixes) is attached to this mail. Hi again Konstantin, Interesting work. No longer applies -- please rebase. -- Thomas Munro https://enterprisedb.com

Re: Built-in connection pooler

2019-03-20 Thread Konstantin Knizhnik
of worker backend).     3. Built-in proxy connection pooler: implementation proposed in this thread.     16/1 and 16/2 specifies number of worker backends per proxy and number of proxies, total number of backends is multiplication of this values.     4. Yandex Odyssey (32/2 and 64/4

Re: Built-in connection pooler

2019-01-29 Thread Konstantin Knizhnik
On 29.01.2019 8:14, Michael Paquier wrote: On Mon, Jan 28, 2019 at 10:33:06PM +0100, Dimitri Fontaine wrote: In other cases, it's important to measure and accept the possible performance cost of running a proxy server between the client connection and the PostgreSQL backend process. I

Re: Built-in connection pooler

2019-01-29 Thread Konstantin Knizhnik
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 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

Re: Built-in connection pooler

2019-01-28 Thread Michael Paquier
On Mon, Jan 28, 2019 at 10:33:06PM +0100, Dimitri Fontaine wrote: > In other cases, it's important to measure and accept the possible > performance cost of running a proxy server between the client connection > and the PostgreSQL backend process. I believe the numbers shown in the > previous email

Re: Built-in connection pooler

2019-01-28 Thread Dimitri Fontaine
Hi, Bruce Momjian writes: > It is nice it is a smaller patch. Please remind me of the performance > advantages of this patch. The patch as it stands is mostly helpful in those situations: - application server(s) start e.g. 2000 connections at start-up and then use them depending on user

Re: Built-in connection pooler

2019-01-28 Thread Bruce Momjian
On Thu, Jan 24, 2019 at 08:14:41PM +0300, Konstantin Knizhnik wrote: > The main differences with pgbouncer 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

Built-in connection pooler

2019-01-24 Thread Konstantin Knizhnik
Hi hacker, I am working for some time under built-in connection pooler for Postgres: https://www.postgresql.org/message-id/flat/a866346d-5582-e8e8-2492-fd32732b0783%40postgrespro.ru#b1c354d5cf937893a75954e1e77f81f5 Unlike existed external pooler, this solution supports session semantic