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 642DE8B9B72 for ; Thu, 3 Feb 2005 18:41:15 +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 69453-02 for ; Thu, 3 Feb 2005 18:41:04 +0000 (GMT) Received: from marsha.pcisys.net (marsha.pcisys.net [216.229.32.146]) by svr1.postgresql.org (Postfix) with ESMTP id 0E5988B9F1E for ; Thu, 3 Feb 2005 18:41:04 +0000 (GMT) Received: from [192.168.0.4] (dsl-206-53-29-107.cos.pcisys.net [206.53.29.107]) by marsha.pcisys.net (8.12.11/8.12.11) with ESMTP id j13If2Tn026601 for ; Thu, 3 Feb 2005 11:41:03 -0700 (MST) User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Thu, 03 Feb 2005 11:41:00 -0700 Subject: Re: How to handle missing pgsql.connect_timeout From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <200502020949.21251.vygen@planwerk6.de> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/9 X-Sequence-Number: 2983 on 2/2/05 1:49 AM, vygen@planwerk6.de purportedly said: > It's not broken anymore! And it speeds up your website. This is true, insofar as you avoid the connection overhead, but in my experience if your DB is local (i.e. on the same machine as your web site), the difference amounts to fractions of a second. There are also many pitfalls to using persistent connections, including greater overhead since you are far more likely to have idle connections, unless every single HTTP call includes a database call--and I mean *every* call: images, css, scripts, etc. You may also want to set pgsql.auto_reset_persistent to handle broken persistent links. >> We were constantly getting connections that wouldn't close, and >> sometimes not time out. Ever since we gave up on them, we've had no >> problems. > > Thats not exactly my problem. I just want to have say > > 20 MaxClients to wait for http Connections > but only 5 possible DB Connections In this case, you probably don't want persistent connections at all. To use persistent connections properly under moderate loads your max clients and max db connections should be the same, or you will definitely have idle (i.e. unused) db connections. > I http server no. 6 tries to connect i want pg_pconnect (or pg_connect; that > doesn't matter) to wait maximal 1 second and then return an error. AFAIK, if your max_connections setting in the PG server is 5, the 6th connection should return with an immediate error. Perhaps this has changed since I experienced it last--I will leave confirmation up to those who know PG better. Best regards, Keary Suska Esoteritech, Inc. "Demystifying technology for your home or business"