[wp-hackers] Wordpress - Database persistent connection support

Andrew Nacin wp at andrewnacin.com
Fri Aug 23 16:27:49 UTC 2013


On Fri, Aug 23, 2013 at 12:03 PM, Rarylson Freitas <rarylson at gmail.com>wrote:

> I see that Wordpress uses the mysql_connect funcion in wp-db.php file. So,
> the db_connect() function always return a non persistent connection to the
> database.


I was discussing this with a few others this week. This is interesting, but
it isn't clear how much it would help. It is my understanding that we would
need to monitor connection limits and open connections, especially on
shared servers. It might be nice to add a flag (as proposed) but it would
make sense to figure out whether this makes sense as a default, and if not,
why not, as that in itself could be informative to the dangers of using
persistent connections.

If this had a benefit to sites on overloaded shared servers, I would think
someone (if not a hosting company) would have proposed it at some point in
the last six years. This anecdotally suggests to me that there is limited
benefit or even detriment for most sites. HyperDB also has hypothetical
persistent connection support, but it is turned off by default and I am
unsure if anyone uses it.

Interestingly, the "drawbacks" covered on
http://php.net/manual/en/features.persistent-connections.php seem far worse
for us than the giant red "warning".

So, I propose a patch (to Wordpress v.3.5.1).


Please always patch current trunk, or at worst, latest stable (3.6).
Indeed, 3.5.1 isn't even the latest stable in the 3.5 branch.

Nacin


More information about the wp-hackers mailing list