Which connection pool to choose? PHP and connection pooling
editWhich connection pool to choose? PHP and connection pooling
editAt first blush, the sniffingConnectionPool implementation seems superior. For many languages, it is. In PHP, the conversation is a bit more nuanced.
Because PHP is a share-nothing architecture, there is no way to maintain a connection pool across script instances. This means that every script is responsible for creating, maintaining, and destroying connections on every instantiation.
Sniffing is a relatively lightweight operation but it may be considered a non-negligible overhead for certain PHP applications.
The average PHP script will likely load the client, execute a few queries and then close. Imagine this script being called 1000 times per second: the sniffing connection pool will perform the sniffing and pinging process 1000 times per second.
In reality, if your script only executes a few queries, the sniffing concept is too robust. It tends to be more useful in long-lived processes which potentially "out-live" a static list.
For this reason the default connection pool is currently the staticNoPingConnectionPool. You can, of course, change this default - but we strongly recommend you load test and verify that it does not negatively impact your performance.