|
Posted by Manuel Lemos on 12/20/05 15:20
Hello,
on 12/19/2005 11:39 PM Susan Baker said the following:
> Does PHP (or maybe the web server - Apache in my case), support
> (database) connection pooling?. It seems terribly inefficient if every
> request for data wil incurr the overhead of creating a connection to the
> db.
Apache supports connection pooling. Just set the MaxClients to a
reasonable limit. If there are more requests, clients will be enqueued.
Actually that is the smart way to achieve PHP database connection pooling.
If you move all static data to a separate server and keep only PHP
scripts that always use database connections in the same server, setting
Apache MaxClients achives the same effect as using a database connection
pooling middleware, except that it will be faster as there is no
middleware delay the communication with the database.
Here you can read more about this:
http://www.meta-language.net/metabase-faq.html#excessive-connections
> While on the subject of pooling - does any one know (when using PHP in
> "server side scripting") if scripts are launched as seperate processes
> or if they are spawned as threads in a thread pool of a master process?
> (pref the latter since it is less "expensive" in computer resource terms)
It depends on the Web server, but multi-threading servers are not
recommended with PHP because some extensions of PHP are not thread-safe.
--
Regards,
Manuel Lemos
Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
[Back to original message]
|