From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guillaume Smet <guillaume.smet@gmail.com>
Cc: David Johnston <polobo@yahoo.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Connection pooling - Number of connections
Date: Fri, 21 Mar 2014 12:17:42 -0400
Message-ID: <18360.1395418662@sss.pgh.pa.us> (raw)
In-Reply-To: <CALt0+o-W_rTy2M+5rHb61KksSBrCncOT_4=ctf3e_MKYTTVTdA@mail.gmail.com>
References: <CALt0+o-5wuUA_1TjNTb+xP43=Ua6ge5PuyOo51QcmDM6cnm9-g@mail.gmail.com>
<1395416983206-5797030.post@n5.nabble.com>
<CALt0+o-W_rTy2M+5rHb61KksSBrCncOT_4=ctf3e_MKYTTVTdA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Guillaume Smet <guillaume.smet@gmail.com> writes:
> On Fri, Mar 21, 2014 at 4:49 PM, David Johnston <polobo@yahoo.com> wrote:
>> Consider this train-of-thought: no matter how large the pool size if you
>> are constantly keeping, say, 90% of the connections actively working then
>> having, on average, 10% of the connections sitting idle is probably not
>> going to be noticeable on the server and the reduction in overhead of
>> managing a pool is typically a net positive. Now, I had no clue what
>> percentage is actually true, or under what conditions and pool sizes it may
>> vary, but that is a calculation that someone deciding on between managed and
>> un-managed pools would need to make.
> Sure.
> The big question is if it is suited for general purpose or if having
> 100 connections open when 10 only are necessary at the time is causing
> any unnecessary contention/spinlock issues/performance
> overhead/whatever...
It will cost you, in ProcArray scans for example. But lots-of-idle-
connections is exactly what a pooler is supposed to prevent. If you have
a server that can handle say 10 active queries, you should have a pool
size of 10, not 100. (If you have a server that can actually handle
100 active queries, I'd like to have your IT budget.)
The proposed design sounds fairly reasonable to me, as long as users are
clear on how to set the pool size --- and in particular that bigger is
not better. Clueless users could definitely shoot themselves in the
foot, though.
regards, tom lane
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, guillaume.smet@gmail.com, polobo@yahoo.com
Subject: Re: Connection pooling - Number of connections
In-Reply-To: <18360.1395418662@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox