Thread: persistant connections?

persistant connections?

From
Aarmel
Date:
Can people give me a brief pro's and con's for persistant connections?

Any major problems with them, such as ensureing they are closed for example?


Re: persistant connections?

From
"Adam Lang"
Date:
If used correctly, they will save resources on your system and improve
performance.  To look out for is to make sure they are configured correctly.
Following is a previous email involving that topic:

From Alexey Borzov
<start quote>
  Well, there's a problem with PHP's [mis]documentation. First of all,
it counts open DB connections not on per-webserver, but on
per-process/thread basis.
  The default PHP config file has the limits of persistent and
non-persistent connections set to -1 (no limit)... Setting it to
some (supposedly) reasonable value (like, 50) accomplishes nothing: you
should multiply 50 by the number of webserver processes/threads. There
can be lots of them... :[
  And then there comes PHP's "logic": if I can just open the new
connection, why bother reusing the old one? And thus Postgres backends
start multiplying like rabbits, eventually reaching the limit... :[
  You should set a reasonable limit on number of open persistent
connections (like 1, maybe 2 or 3), only then PHP will actually reuse
them. My webserver now works with such setup and there are no more
problems with pg_pconnect().
<end quote>

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Aarmel" <pgadmin@animated.net.au>
To: <pgsql-php@postgresql.org>
Sent: Friday, December 08, 2000 2:25 AM
Subject: [PHP] persistant connections?


> Can people give me a brief pro's and con's for persistant connections?
>
> Any major problems with them, such as ensureing they are closed for
example?