Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEWDp-0008KC-4t for pgsql-general@arkaria.postgresql.org; Wed, 28 Jun 2023 14:32:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qEWDm-0004nK-Rx for pgsql-general@arkaria.postgresql.org; Wed, 28 Jun 2023 14:32:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qEWDm-0004mF-Ga for pgsql-general@lists.postgresql.org; Wed, 28 Jun 2023 14:32:38 +0000 Received: from dragonfly.birch.relay.mailchannels.net ([23.83.209.51]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qEWDj-000vqn-Rj for pgsql-general@postgresql.org; Wed, 28 Jun 2023 14:32:37 +0000 X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0D0998200A3; Wed, 28 Jun 2023 14:32:34 +0000 (UTC) Received: from mi3-ss103.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 64BE6820060; Wed, 28 Jun 2023 14:32:32 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1687962752; a=rsa-sha256; cv=none; b=tMeREa3BCIMxoD+/O8/jVTNi0eqOfp7M8nyI/dPxCZ3thhY5hUYgkE6xnSLs1VMsoHhU++ u5GLiD7xMPSQmshCR2LmKt7dyvTKcbToLq94mXPpBICb5DAn2lRpTohITNS8BAOBoji3r4 FteU2ynDSqcchMAbSnU35xBoPZK/EF152btC4Deo/JyEOWM6kqDKeAFSgZrunrcTnBWarA 9Y3E8/S+I/SE0ceUsjdpn6AogIIZIXwyvIh+W+BlIGWyY+sVzxB4zJJWLZ25ckgL+7VJBm TY5022M7+kC/s87Q5MbOaj9UTqXULiG9Ho6gmYqf5FnzRFskilF2RD++AvPzaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1687962752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Q8xuq+cbTYBNFpvBigfD9PiBQ5N8QWdcK1MGf9enZSE=; b=oFLHAsYWR1Qa2Do5i6pBpMNaKf/mHIwYF0eO1srp9YAZIgA0RnJMNl9ENE5yabVdYXVh9J ByEy/lNAOToc59mNujHHRPpfnBLf6n7HIeTeZOcROIdUDjIp4PSp1LGGTrwQRfej/w7ZaI d+yM3wd+wLxY9+sdKorTZ2H1p+Hck1r7s0MEw8RXbk5S0oJ/lCpuYKTFWTa5sTHYNm/kIo JJ0Dvc2xAYT3WX6Bz6t8boIqphe6jsKEShxnUro9XjTi7WLpYn7KpZ1tUSnmElaljecuWm KPExxOeSgghKxjRef7150bXX4QM8qmJ2hyEzS0tzAHsiwlFnVF/oTAO6tuJ9Cg== ARC-Authentication-Results: i=1; rspamd-85899d6fcc-t79nn; auth=pass smtp.auth=a2hosting smtp.mailfrom=bench@silentmedia.com X-Sender-Id: a2hosting|x-authuser|bench@silentmedia.com X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|bench@silentmedia.com X-MailChannels-Auth-Id: a2hosting X-Quick-Little: 630f74e9115debca_1687962753803_3544341384 X-MC-Loop-Signature: 1687962753803:3555056895 X-MC-Ingress-Time: 1687962753803 Received: from mi3-ss103.a2hosting.com (mi3-ss103.a2hosting.com [75.98.175.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.97.48.114 (trex/6.9.1); Wed, 28 Jun 2023 14:32:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=silentmedia.com; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Q8xuq+cbTYBNFpvBigfD9PiBQ5N8QWdcK1MGf9enZSE=; b=Nl/v/jOStnoGfzc6popZWmOrZg FInmOiTnPIkTvWwnpIp64CPyhkm3ph+m8jxpA63oyDx5YhxScXKzU9uoSgEI+n9IKO+H+SAnJvL3o zq8HDACDLLzFLhFCDGDlyBIeE9sglYV9FkLvWwCoeRfA4wRcDy+7G2V+u/rouWISrfUMns7nks5Od M6plG3jYySMNjBlTutQctKDcux6TmCwZxea/MbQiVQIOGEj+nseMsgStB7WZWxmyRhGGM22Ua71SD ozDmGZHlsJDANo0x/1aX5/LbTKv5lLLucFOTQM+aCGhX6jagxrFl2OOtOrAICKLaWmJfUyuDpkm0l Fuwv/WIg==; Received: from [97.113.93.39] (port=58970 helo=simplicity.local) by mi3-ss103.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1qEWDh-00GRlK-1B; Wed, 28 Jun 2023 10:32:31 -0400 Subject: Re: pgbouncer To: Laurenz Albe Cc: Rita , "pgsql-general@postgresql.org >> PG-General Mailing List" References: <133e7d3d127b430e61f80934eba44b5ba98eb51e.camel@cybertec.at> From: Ben Chobot Message-ID: Date: Wed, 28 Jun 2023 07:32:29 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:52.0) Gecko/20100101 PostboxApp/7.0.60 MIME-Version: 1.0 In-Reply-To: <133e7d3d127b430e61f80934eba44b5ba98eb51e.camel@cybertec.at> Content-Type: multipart/alternative; boundary="------------7257A42EC2BD54B21CE3345D" Content-Language: en-US X-AuthUser: bench@silentmedia.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------7257A42EC2BD54B21CE3345D Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Laurenz Albe wrote on 6/28/23 5:27 AM: > On Wed, 2023-06-28 at 07:19 -0400, Rita wrote: >> seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver? > On the database server. You don't want network latency between pgbouncer and PostgreSQL, > so that the connections can be active as much as possible. > That will improve throughput. This is true, but as somebody who also deploys a fleet of stand-alone pgBouncers in front of his dbs, a good reason to have a pgBouncer-based traffic spigot before traffic hits your db server is that you can pause traffic from the client to the db during maintenance, up to and including replacing your entire db server, and all clients see is a period of the db acting slow. For applications that struggle with connection management, this can be very valuable. --------------7257A42EC2BD54B21CE3345D Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
Laurenz Albe wrote on 6/28/23 5:27 AM:
On Wed, 2023-06-28 at 07:19 -0400, Rita wrote:
seems like I may need to deploy pgbouncer for my webapp. should i deploy it on the db server or on the webserver?
On the database server.  You don't want network latency between pgbouncer and PostgreSQL,
so that the connections can be active as much as possible.
That will improve throughput.

This is true, but as somebody who also deploys a fleet of stand-alone pgBouncers in front of his dbs, a good reason to have a pgBouncer-based traffic spigot before traffic hits your db server is that you can pause traffic from the client to the db during maintenance, up to and including replacing your entire db server, and all clients see is a period of the db acting slow.

For applications that struggle with connection management, this can be very valuable.
--------------7257A42EC2BD54B21CE3345D--