Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 2EEC71337D6F for ; Tue, 14 Sep 2010 14:14:33 -0300 (ADT) 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 84419-01 for ; Tue, 14 Sep 2010 17:14:25 +0000 (UTC) X-Greylist: delayed 00:29:55.672405 by SQLgrey-1.7.6 Received: from mail-ey0-f174.google.com (mail-ey0-f174.google.com [209.85.215.174]) by mail.postgresql.org (Postfix) with ESMTP id 919C11337E2E for ; Tue, 14 Sep 2010 14:14:25 -0300 (ADT) Received: by eyb6 with SMTP id 6so3219248eyb.19 for ; Tue, 14 Sep 2010 10:14:24 -0700 (PDT) Received: by 10.223.116.200 with SMTP id n8mr44192faq.18.1284482669124; Tue, 14 Sep 2010 09:44:29 -0700 (PDT) Received: from Craig-Jamess-MacBook-Pro.local (wsip-70-167-124-126.sd.sd.cox.net [70.167.124.126]) by mx.google.com with ESMTPS id r4sm118268faa.43.2010.09.14.09.44.23 (version=SSLv3 cipher=RC4-MD5); Tue, 14 Sep 2010 09:44:28 -0700 (PDT) Message-ID: <4C8FA663.9050409@emolecules.com> Date: Tue, 14 Sep 2010 09:44:19 -0700 From: Craig James User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 MIME-Version: 1.0 To: pgsql-performance@postgresql.org, dvlhntr@gmail.com Subject: Re: Held idle connections vs use of a Pooler References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201009/79 X-Sequence-Number: 40282 On 9/14/10 9:10 AM, mark wrote: > Hello, > > I am relatively new to postgres (just a few months) so apologies if > any of you are bearing with me. > > I am trying to get a rough idea of the amount of bang for the buck I > might see if I put in a connection pooling service into the enviroment > vs our current methodology of using persistent open connections. > > We have a number of in house applications that connect to a central > Postgres instance. (8.3.7). The box is admitting underpowered with > only 8 cores, and 8gb or ram and not great disk IO out of an MSA-70. > the database is about 35GB on disk and does mainly (~95%) OTLP type > queries. I am currently begging for more ram. > > Most of the connections from the various apps hold idle connections > until they need to execute a query once done go back to holding an > open idle connection. (there are ~600 open connections at any given > time, and most of the time most are idle) > > this is typically fine while the number of active queries is low, but > some other application (that doesn't use connection pooling or holding > open connections when not in use) is hitting the db from time to time > with 50-100 small queries (2ms queries from my testing) nearly all at > once. when this happens the whole response time goes out the door > however). While connection pooling may be a good answer for you, there also appears to be a problem/bug in 8.3.x that may be biting you. My installation is very similar to yours (hundreds of idle "lightweight" connections, occasional heavy use by certain apps). Look at this thread: http://archives.postgresql.org/pgsql-performance/2010-04/msg00071.php On the server that's been upgraded to 8.4.4, we're not seeing this problem. But it's not in full production yet, so I can't say for sure that the CPU spikes are gone. (Unfortunately, the archives.postgresql.org HTML formatting is horrible -- why on Earth can't it wrap lines?) Craig > > > I think from reading this list for a few weeks the answer is move to > using connection pooling package elsewhere to better manage incoming > connections, with a lower number to the db. > > I am told this will require some re-working of some app code as I > understand pg-pool was tried a while back in our QA environment and > server parts of various in-house apps/scripts/..etc started to > experience show stopping problems. > > to help make my case to the devs and various managers I was wondering > if someone could expand on what extra work is having to be done while > queries run and there is a high (500-600) number of open yet idle > connections to db. lots of the queries executed use sub-transactions > if that makes a difference. > > > basically what I am paying extra for with that many persistent > connections, that I might save if I go to the effort of getting the > in-house stuff to make use of a connection pooler ? > > > thank you for your time. > > ..: mark >