Re: Proposal: Establish DB connections during module_init

From: Date: Wed, 07 Jun 2000 04:14:17 +0000
Subject: Re: Proposal: Establish DB connections during module_init
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-20421@lists.php.net to get a copy of this message
This sounds good to me. I would like to think of a more thorough connection polling solution for multi-threaded servers such as Apache 2.x but I guess that can wait. Andi At 07:24 PM 6/6/00 -0700, Rasmus Lerdorf wrote:
I have run across a situation where the delay involved in establishing a connection is a bottleneck. The traditional answer to this is to use persistent connections. However, the problem is that with persistent connections the db connection is not established until the first request to a new httpd process which means that the unfortunate user that happens to be the first to that process will experience a delay. It should be possible to define the DB connection parameters in php.ini/httpd.conf and have the connection established during the module_init phase. Because of the pre-forking nature of Apache, the db connection delay will always happen right after a new httpd process is launched and such new processes are launched to satisfy the min_spare_servers setting. That means new processes are most likely to come up idle and no user would end up seeing the connection delay. Anybody see why this might be a bad idea? Of course it would be optionally triggered by config directives. We could use the existing default_host and default_user settings and just flick a switch. ie. <VirtualHost www.php.net> php_admin_value mysql.default_host=localhost php_admin_value mysql.default_user=rasmus php_admin_value mysql.default_password=foobar php_admin_value mysql.autoconnect=On ... </VirtualHost> -Rasmus -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#20421) next »