[wp-hackers] Persistent connections
Peter van der Does
peter at avirtualhome.com
Thu Mar 18 18:04:48 UTC 2010
On Thu, 18 Mar 2010 10:01:43 -0400
Andrew Gray <andrew at graymerica.com> wrote:
> Does anyone have an opinion on using persistent DB connections
> (altering the DB.php to user mysql_pconnect instead) Has anyone with
> a high volume site seen an improvement by making this change.
>
> I am looking for a way to stop getting limited by the max number of
> connections from my host. I get about 5 Million page views per month
> and have a lot of commentors (so the page level caching and DB
> caching is not alway appropriate. My pages average 30 DB queries per
> page and under about .4 second query time) I am hosted at the
> Rackspace Cloud and have a max connection setting of 500.
>
> thanks for the advice,
>
> Andrew
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
I don't think using persistent connections will solve your problem.
WordPress opens a database connection for every page generated and
closes it at the end.
If you use persistent connections the connection will not close and
will be available for the next PHP instance. The gain you can have is
not having the overhead of opening and closing of the DB connection. In
theory your site will become faster. (This is not always the case,
misconfiguration can lead to slower response or even complete stall)
In other words, with and without persistent connections you can only
have 500 connections at the same time.
What you need to look at is how fast can a connection be freed, so how
fast is the page build up in WordPress. It makes sense that the quicker
you free up a connection the quicker it can be reused.
--
Peter van der Does
GPG key: E77E8E98
IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes
WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware
More information about the wp-hackers
mailing list