View Issue Details

IDProjectCategoryView StatusLast Update
0000715Pgpool-IIGeneralpublic2021-06-22 11:41
Reportermanikan Assigned Topengbo  
PriorityhighSeveritymajorReproducibilityN/A
Status closedResolutionopen 
Product Version4.2.3 
Summary0000715: PgPool Loadbalancer in Kubernetes
DescriptionHi,

This is the first time trying to use PgPool. Planning to setup a PgPool to load balance between Google Cloud SQL primary and read replicas.

Scenario:
If the max connections of primary and read replicas instances are set to 200 individually. So if we setup the num_init_children to 400 and max_pool to 1 which can accept max of 400 connections totally by PgPool.

For the above scenario, say for an example, at a given time, the number of primary connection is 200 and read replicas is 100 Now if a write request is asking for a connection and all 200 connections of primary instance are in use, PgPool will try to create a connection because the number of max connection is less than 400. In this case, cloud SQL will thrown an error that it is reached the max limit.

Can you please let me know on how can we set the max connections at individual Postgres instance level instead of overall level via num_init_children and max_pool in case of load balance usage?
TagsNo tags attached.

Activities

pengbo

2021-05-25 00:50

developer   ~0003849

> Can you please let me know on how can we set the max connections at individual Postgres instance level instead of overall level via num_init_children and max_pool in case of load balance usage?

You need to configure max_pool, num_init_children, max_connections and superuser_reserved_connections to satisfy:

  number of Pgpool-II replicas × max_pool × num_init_children <= (max_connections - superuser_reserved_connections)

manikan

2021-05-25 01:18

reporter   ~0003851

But for the scenario which I have explained should have the max connection of 400 connections (200 max connections of primary and 200 max connections of read replicas) set at PgPool level.

Say for an example, at a given point of time, primary instance is already having 200 concurrent connections and read replicas is having 100 concurrent connections.

In this case, if the client try to ask PgPool to give me one more connection for Primary instance, PgPool will try to create one more connection, this is because the current max connections between primary and read replica is less than the max connection set at the PgPool level but if you note that it's have already reached the max connection for primary instance. That's why asked the question on how PgPool will track an individual instance max connection?

pengbo

2021-05-25 15:19

developer   ~0003855

> But for the scenario which I have explained should have the max connection of 400 connections (200 max connections of primary and 200 max connections of read replicas) set at PgPool level.

I think you may have misunderstood the connections between Pgpool-II and PostgreSQL.
If client connects to Pgpool-II, then Pgpool-II will create connections to each PostgreSQL (Service).

About the connections between Pgpoo-II and PostgreSQL, please see to attachment.
max_connections.pptx (192,908 bytes)

manikan

2021-05-25 22:11

reporter   ~0003856

Thanks for the info. Quick question to understand it.

Based on the picture, max connections is configured at Postgres server level as 300 for each individual instances (primary, read replica 1 and read replica 3), so totally PgPool need to cache 900 connections right?

If so, configuring num_init_children as 300 should be fine? Whether PgPool will internally cache 900 connections for all instances (300 for each instance)?

pengbo

2021-05-27 11:29

developer   ~0003858

> Based on the picture, max connections is configured at Postgres server level as 300 for each individual instances (primary, read replica 1 and read replica 3), so totally PgPool need to cache 900 connections right?

Yes.

> If so, configuring num_init_children as 300 should be fine? Whether PgPool will internally cache 900 connections for all instances (300 for each instance)?

num_init_children = 300 should be fine.
In this case, Pgpool-II will cache up to 900 connections.
If there are no requests from application, Pgpool-II doesn't create and cache connections in advance.

pengbo

2021-06-08 13:55

developer   ~0003870

Have you resolved this issue?
May I close this issue?

pengbo

2021-06-22 11:41

developer   ~0003881

Close issue.

Issue History

Date Modified Username Field Change
2021-05-24 14:58 manikan New Issue
2021-05-25 00:50 pengbo Note Added: 0003849
2021-05-25 00:50 pengbo Assigned To => pengbo
2021-05-25 00:50 pengbo Status new => feedback
2021-05-25 01:18 manikan Note Added: 0003851
2021-05-25 01:18 manikan Status feedback => assigned
2021-05-25 15:19 pengbo Note Added: 0003855
2021-05-25 15:19 pengbo File Added: max_connections.pptx
2021-05-25 15:20 pengbo Status assigned => feedback
2021-05-25 22:11 manikan Note Added: 0003856
2021-05-25 22:11 manikan Status feedback => assigned
2021-05-27 11:29 pengbo Note Added: 0003858
2021-06-01 13:00 pengbo Status assigned => feedback
2021-06-08 13:55 pengbo Note Added: 0003870
2021-06-22 11:41 pengbo Note Added: 0003881
2021-06-22 11:41 pengbo Status feedback => closed