Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR28i-0004UC-Ga for pgsql-performance@arkaria.postgresql.org; Fri, 21 Mar 2014 16:17:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WR28h-0004tk-Tu for pgsql-performance@arkaria.postgresql.org; Fri, 21 Mar 2014 16:17:47 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR28h-0004te-29 for pgsql-performance@postgresql.org; Fri, 21 Mar 2014 16:17:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WR28e-0007w5-AP for pgsql-performance@postgresql.org; Fri, 21 Mar 2014 16:17:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2LGHgDp018361; Fri, 21 Mar 2014 12:17:42 -0400 From: Tom Lane To: Guillaume Smet cc: David Johnston , "pgsql-performance@postgresql.org" Subject: Re: Connection pooling - Number of connections In-reply-to: References: <1395416983206-5797030.post@n5.nabble.com> Comments: In-reply-to Guillaume Smet message dated "Fri, 21 Mar 2014 17:05:03 +0100" Date: Fri, 21 Mar 2014 12:17:42 -0400 Message-ID: <18360.1395418662@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Guillaume Smet writes: > On Fri, Mar 21, 2014 at 4:49 PM, David Johnston 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