Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id B145B2E004E for ; Tue, 22 Apr 2008 12:56:55 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 96691-01 for ; Tue, 22 Apr 2008 12:56:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ironic.cynic.net (125x100x126x243.ap125.ftth.ucom.ne.jp [125.100.126.243]) by developer.postgresql.org (Postfix) with ESMTP id 816832E0044 for ; Tue, 22 Apr 2008 12:56:48 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ironic.cynic.net (Postfix) with ESMTP id 82A4F1F844; Wed, 23 Apr 2008 00:56:46 +0900 (JST) Date: Wed, 23 Apr 2008 00:56:46 +0900 From: Bryan Buecking To: "Joshua D. Drake" Cc: pgsql-performance@postgresql.org Subject: Re: CPU bound at 99% Message-ID: <20080422155640.GD5961@starling-software.com> References: <20080422153045.GB5961@starling-software.com> <20080422084109.18e4282e@commandprompt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080422084109.18e4282e@commandprompt.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.1 tagged_above=0 required=5 tests=AWL=1.000, RDNS_DYNAMIC=0.1 X-Spam-Level: * X-Archive-Number: 200804/321 X-Sequence-Number: 29814 On Tue, Apr 22, 2008 at 08:41:09AM -0700, Joshua D. Drake wrote: > On Wed, 23 Apr 2008 00:31:01 +0900 > Bryan Buecking wrote: > > > at any given time there is about 5-6 postgres in startup > > (ps auxwww | grep postgres | grep startup | wc -l) > > > > about 2300 connections in idle > > (ps auxwww | grep postgres | idle) > > > > and loads of "FATAL: sorry, too many clients already" being logged. > > > > The server that connects to the db is an apache server using > > persistent connections. MaxClients is 2048 thus the high number of > > connections needed. Application was written in PHP using the Pear DB > > class. > > Sounds like your pooler isn't reusing connections properly. The persistent connections are working properly. The idle connections are expected given that the Apache child process are not closing them (A la non-persistent). The connections do go away after 1000 requests (MaxChildRequest). I decided to move towards persistent connections since prior to persistent connections the idle vs startup were reversed. -- Bryan Buecking http://www.starling-software.com