Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 974381337B64 for ; Tue, 23 Nov 2010 20:11:45 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 80013-03 for ; Wed, 24 Nov 2010 00:11:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 5B9C01337B4E for ; Tue, 23 Nov 2010 20:11:38 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 9E1F5149C; Tue, 23 Nov 2010 19:11:38 -0500 (EST) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id G6xiGemJrilg; Tue, 23 Nov 2010 19:11:37 -0500 (EST) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id A1C652D; Tue, 23 Nov 2010 19:11:37 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 617EAAE682; Wed, 24 Nov 2010 08:11:36 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5KCP8R0NI1xs; Wed, 24 Nov 2010 08:11:30 +0800 (WST) Received: from [10.1.1.5] (203-206-85-220.dyn.iinet.net.au [203.206.85.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 3A444AE514; Wed, 24 Nov 2010 08:11:30 +0800 (WST) Message-ID: <4CEC5830.90805@postnewspapers.com.au> Date: Wed, 24 Nov 2010 08:11:28 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc14 Thunderbird/3.1.4 MIME-Version: 1.0 To: Ivan Voras CC: pgsql-performance@postgresql.org Subject: Re: Performance under contention References: <4CE9773D0200002500037CA6@gw.wicourts.gov> <4CEA373D0200002500037CED@gw.wicourts.gov> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/361 X-Sequence-Number: 41385 On 11/22/2010 11:38 PM, Ivan Voras wrote: > On 11/22/10 16:26, Kevin Grittner wrote: >> Ivan Voras wrote: >>> On 11/22/10 02:47, Kevin Grittner wrote: >>>> Ivan Voras wrote: >>>> >>>>> After 16 clients (which is still good since there are only 12 >>>>> "real" cores in the system), the performance drops sharply >>>> >>>> Yet another data point to confirm the importance of connection >>>> pooling. :-) >>> >>> I agree, connection pooling will get rid of the symptom. But not >>> the underlying problem. I'm not saying that having 1000s of >>> connections to the database is a particularly good design, only >>> that there shouldn't be a sharp decline in performance when it >>> does happen. Ideally, the performance should remain the same as it >>> was at its peek. >> >> Well, I suggested that we add an admission control[1] mechanism, > > It looks like a hack (and one which is already implemented by connection > pool software); the underlying problem should be addressed. My (poor) understanding is that addressing the underlying problem would require a massive restructure of postgresql to separate "connection and session state" from "executor and backend". Idle connections wouldn't require a backend to sit around unused but participating in all-backends synchronization and signalling. Active connections over a configured maximum concurrency limit would queue for access to a backend rather than fighting it out for resources at the OS level. The trouble is that this would be an *enormous* rewrite of the codebase, and would still only solve part of the problem. See the prior discussion on in-server connection pooling and admission control. Personally I think the current approach is clearly difficult for many admins to understand and it's unfortunate that it requires external software to be effective. OTOH, I'm not sure what the answer is. -- Craig Ringer