Database Connection Pooling with Smart Reset
PHP opens a new MySQL connection on every request, but ePHPm reuses them and cleans up only the ones that need it. Here's how that works, two bugs it had and how much load it takes off MySQL.
PHP’s share-nothing model is one of its best properties. It has one expensive side effect: a request can’t keep a
database connection for the next request. php-fpm gives you PDO::ATTR_PERSISTENT and mysqli’s p: hosts. But
those are per-worker-process. PDO’s keep whatever session state the last request left behind. mysqli at least resets
the session with COM_CHANGE_USER on reuse. And almost nobody turns them on. So in practice every PHP request does a
TCP connect, a MySQL…
