Proposal: Establish DB connections during module_init

From: Date: Wed, 07 Jun 2000 02:24:23 +0000
Subject: Proposal: Establish DB connections during module_init
Groups: php.dev 
Request: Send a blank email to php-dev+get-20419@lists.php.net to get a copy of this message
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

« previous php.dev (#20419) next »