Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPNRu-004I6L-GQ for pgsql-admin@arkaria.postgresql.org; Thu, 04 Jul 2024 14:28:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sPNRs-000CaF-Ci for pgsql-admin@arkaria.postgresql.org; Thu, 04 Jul 2024 14:28:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPNRs-000Ca7-1V for pgsql-admin@lists.postgresql.org; Thu, 04 Jul 2024 14:28:36 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPNRp-000NfQ-F7 for pgsql-admin@lists.postgresql.org; Thu, 04 Jul 2024 14:28:35 +0000 Message-ID: <1e2678b7-8ab5-c2d4-89e1-bcfe7ea8ddcb@cloud.gatewaynet.com> Date: Thu, 4 Jul 2024 17:28:29 +0300 MIME-Version: 1.0 Subject: Re: Connection pooler / LDAP auth / Load Balancing on read-only queries Content-Language: en-US To: Scott Ribe Cc: pgsql-admin@lists.postgresql.org References: <1745e084-a408-445f-97e3-44e29977ccc5@cloud.gatewaynet.com> <5b9df232-3c9e-ad5c-ffde-7d6b07452041@cloud.gatewaynet.com> <07B2F39D-E2A2-45C2-939D-85EF980176B1@elevated-dev.com> From: Achilleas Mantzios - cloud In-Reply-To: <07B2F39D-E2A2-45C2-939D-85EF980176B1@elevated-dev.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/4/24 15:47, Scott Ribe wrote: >> Hello >> >> pgpool does a great job at that. pgpool does load balancing to the first statement that is considered a write statement, for that point on, the rest of the transaction is routed to the primary. >> >> But the question here is how to achieve all of the aforementioned features, of all those great tools combined, or ideally combined in one. > AFAIK, pgpool still doesn't do what I'd consider true pooling, that is MxN multiplexing of connections. (Every client connection has a connection from pgpool -> server, but the server connections become available for resuse when clients disconnect.) Yes, unfortunately, pgbouncer shines in this department. > > And to me, the mechanism for routing queries in a transaction is highly suspect, as the initial reads vs later writes could potentially be using different snapshots of the data. (There is a safeguard there, involving looking at replication delay, but that's not a transactional guarantee, just "here's how out of date the replica can be to get read queries".) It seems pgpool supports snapshot_isolation mode, which is similar to streaming_replication, + it adds visibility consistency, but at the expense of running with default_transaction_isolation = 'repeatable read' : https://www.pgpool.net/docs/latest/en/html/runtime-config-running-mode.html#GUC-SNAPSHOT-ISOLATION-MODE Read latency is an issue with asynchronous physical replication, but then again, the problem is there no matter the HA/pooling solution.