X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2CBDA3AC161 for ; Wed, 29 Dec 2004 16:41:21 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50824-10 for ; Wed, 29 Dec 2004 16:41:04 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 28D633AC13C for ; Wed, 29 Dec 2004 16:40:01 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.207]) by www.postgresql.com (Postfix) with ESMTP id 989E3739246 for ; Wed, 29 Dec 2004 16:39:59 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 49so328839wri for ; Wed, 29 Dec 2004 08:38:24 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=pUmLPQArUJkllt+A5xpHO9JyHsnMdEVkfEMEYAFOEs39rH+XN0o9MvGm6Zbf2KNsiu0n6P6xzPL5TGfqH9lEP64pAwOYyL/CBuMN7Gvgi9/BpkHJ7RacSpoOecJWSylXtW0mGds2w0w/ugb3eeJdHZT6fWx2kH7mdnG3ZZHLYSY= Received: by 10.54.20.27 with SMTP id 27mr179134wrt; Wed, 29 Dec 2004 08:38:22 -0800 (PST) Received: by 10.54.59.22 with HTTP; Wed, 29 Dec 2004 08:38:22 -0800 (PST) Message-ID: <330532b604122908387f7ffde2@mail.gmail.com> Date: Wed, 29 Dec 2004 11:38:22 -0500 From: Mitch Pirtle Reply-To: Mitch Pirtle To: Matthew Terenzio Subject: Re: too many clients Cc: pgsql-php@postgresql.org In-Reply-To: <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <0DC9A380-59AB-11D9-B3B3-0003938BDF32@localnotion.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200412/2 X-Sequence-Number: 2960 Mey Matt, You got a couple solutions, one of which is getting a connection pooler setup between apache(php) and postgres. SQL Relay (sqlrelay.sf.net) could be a common candidate, as I have used it in the past with great results. Another option could be to implement caching on the webserver of common, static data, by using either a database abstraction library such as ADOdb (adodb.sf.net) that can cache queries, or to implement a RAM-based caching solution such as memcached (www.danga.com/memcached). Some people tell me that persistent connections are actually bad, and to always use pg_connect. I cannot vouch for this approach, but you might want to try it to see if it helps you in your particular situation. I'm rolling out a site that gets >5M page views daily in a couple weeks, so this should be a good opportunity to get some detailed real-world performance metrics. - Mitch On Wed, 29 Dec 2004 10:05:18 -0500, Matthew Terenzio wrote: > After years of running apache-php-postgres with no issues, I'm suddenly > receiving the cannot connect to postgres - too many clients already > error on my script pages. > > 1. Does everyone ALWAYS have Apache max connections lower than postgres > max clients? I tried this but the problem still returned. > > 2.I'm using pg_pconnect(). > > 3. Traffic is slightly higher lately but not that high. > > 4. I'm thinking about apache changing apache maxrequestsperchild from 0 > to maybe 10 or something to periodically kill apache children, but I > can't see why the maxclients in apache would overload postgres if they > are both the same number. It is hard fro me to believe there are > actually that many simultaneous users of this system, so for some > reason the connections are remaining open and unused. > > Any wisdom out there? > > Matt > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >