informix persistent connections
| From: | C. Gordon Clarke | Date: | Wed, 09 Aug 2000 21:32:00 +0000 |
| Subject: | informix persistent connections | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-1910@lists.php.net to get a copy of this message | ||
I'm working on a rather large community site with about a quarter million
users and a database of about a half-million items of user generated content
(bulleting boards, articles, links...). We are running the following
configuration:
-Redundant webservers running Solaris or Linux and php 4.01
-Redundant replicated database servers running Informix 9.02 on Solaris
-Connections to both the webservers and the database servers are load
balanced using a Foundry Networks loadbalancer.
Everything is running fine, but we cannot get informix persistent
connections to work properly. Here is the problem. The persistent db
connections are made between the apache children and the load balancer. The
load balancer handles the db connections from php and proxies them to the
database farm, the proxied connections are maintained in a state table.
After a certain amount of inactivity (in the evenings and early morning
hours), the loadbalancer will kill off the connections and remove them from
the state table. However the apache children, which only die off after a
certain amount of activity, still think there is a persistent connection. So
php starts to serve a page, thinks it connects to the database and then
starts spilling errors when we pass queries. I can catch the error in the
connection, but I cannot disconnect and re-establish the connection.
The ifx_close only works for non-persistent connections (which we have been
forced to use for now, but we lose .5 seconds on a page load). Any ideas on
how to deal with this? The only solution I have is to catch the error and to
redirect to the same page in order to get a new apache child, but this is
risky because there is no guarantee that one has a valid connection either.
Any help would be appreciated - Thanks.
cory