From: Keary Suska <hierophant@pcisys.net>
To: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: How to handle missing pgsql.connect_timeout
Date: Thu, 03 Feb 2005 11:41:00 -0700
Message-ID: <BE27BE4C.19E41%hierophant@pcisys.net> (raw)
In-Reply-To: <200502020949.21251.vygen@planwerk6.de>
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"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: hierophant@pcisys.net
Subject: Re: How to handle missing pgsql.connect_timeout
In-Reply-To: <BE27BE4C.19E41%hierophant@pcisys.net>
References: <200502020949.21251.vygen@planwerk6.de> <BE27BE4C.19E41%hierophant@pcisys.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox