Blogs

Database Connection Pooling Problem -- PHP

The real issue with PHP is that it has no connection pooling to Database. It just open and closes the connection each time a user request a page. When a PHP file finishes executing, all it's state are killed and hence PHP is unable to do connection pooling.

However, one can use mysql_pconnect, in that case connections doesn't get closed after the page had executed, that way they get reused in the next request. But this isn't the same as connection pooling as you cannot mention how many connections to be kept open.

You can use some third party extension for Connection Pooling:

Memcached Module

Memcached is a high-performance, distributed memory object caching system. I had implemented this in some of my projects. Memcached increases application perfomance by caching data in memory.

Memcached server instances listens on a user-defined IP and port.

PHP provides support for the Memcache functions through a PECL extension.

To install the module command is:

pecl install memcache

For detail information on Memcached, please visit Danga Memcached.

Cumulus Tag Cloud

Kiran Says

I love work environment which is:

Informal yet professional
Demanding yet rewarding
Challenging yet inspiring
Mediocrity is not an option
Having fun is serious business
Making mistakes is human
Forgiveness is Company Policy

Travelling Sucks