views:

255

answers:

1

Does 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.

+1  A: 

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

DeveloperChris
We know the PHP loading/compiling time is not the deciding factor because we only see a few milliseconds increase in other transaction without DB access.
ZZ Coder
I am surprised by that. have you done some profiling to determine exactly where the time is lost. could the db have changed in the meantime or the sql query is now different? even a slight difference may cause issues if it means an index is not used or the wrong index is used. mysql_pconnect often doesn't work as well as one hopes as you have found. I have always thought it would be good for php to use pooled connections. but pconnect is a per process connection. It also needs to be enabled in php.ini if you weren't aware of that.
DeveloperChris