Re: pgpool Connections Distributions Among Nodes

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: Virendra(dot)Kumar(at)guycarp(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pgpool Connections Distributions Among Nodes
Date: 2018-01-29 22:46:30
Message-ID: 20180130.074630.2078004443171957980.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> We have 4-node cluster (1 master and 3 hot standby). We are using pgpool as load balancer. We have an observation where if application requests for 3 connections, pgpool connects to all 4 servers and I see 3 connections on each of them. I was expecting it have a total of 3 connections from either of 4 servers but I can easily see 12 connections in all.

Yes, that's an expected behavior.

Why?

When client A connects to pgpool, it connects to all PostgreSQL (a, b,
c, d). But actually pgpool sends query to one of them (in case load
balance node is primary) or two of them (in case load balance node is
not primary). Suppose it sends to a and b. Client A logs off, but
connections to a and b remain because of connection pooling. Client B
comes in. B uses c and d. The connections to c and d remain.

So eventually pgpool needs to connect to all backend anyway.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan De Moerloose 2018-01-29 23:06:36 Meaning of query age in pg_stat_activity
Previous Message Ibrahim Edib Kokdemir 2018-01-29 21:38:02 best way to storing logs