Re: Proposal: Establish DB connections during module_init
| From: | Ly) Vuong | Date: | Wed, 07 Jun 2000 02:55:24 +0000 |
| Subject: | Re: Proposal: Establish DB connections during module_init | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-20420@lists.php.net to get a copy of this message | ||
Excellent idea!
Ly Vuong
----
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