开发者

PHP and mod_dbd

Doe开发者_运维技巧s anyone know a PHP extension to use mod_dbd for database connections?

Our application needs to access a remote database. It used to be an Apache module using mod_dbd for database connections and the transaction takes about 200ms. Now we changed the application to PHP and the same transaction takes over 600ms now. We hope some kind of pooling will improve the performance.

We switched to use mysql_pconnect() but it doesn't work nearly as good as mod_dbd.


I know you have probably given up on an answer but...

I think you'll find that most of the extra time is loading and compiling the PHP script. if your previous app was an apache module then it is precompiled and always loaded, probably written in c so very fast compared to PHP.

Try using a php accelerator like eaccelerator. that uses shared memory and precompiled scripts to sometimes dramatically improve the performance of PHP apps.

DC


In order to benefit from the connection pooling feature of mod_dbd you would need to run a threaded MPM so that several threads can share the connections in the pool. Unfortunately I do believe PHP is not thread-safe, and will not support threaded MPMs.

If you use mod_dbd with the pre-fork MPM (which is not threaded and recommended for PHP) mod_dbd will create a single persistent database connection, which does not give you any huge advantage compared to a database connection in PHP not using mod_dbd.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜