Re: How to handle missing pgsql.connect_timeout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 2/2/05 1:49 AM, vygen@xxxxxxxxxxxx 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"



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux