[wp-hackers] Persistent connections

Andrew Gray andrew at graymerica.com
Thu Mar 18 20:42:41 UTC 2010


Thanks for all the great ideas.  The consensus is that persistent connections will not matter,   I have altered the wp-db.php file to try and reconnect to the DB after waiting a random number of micro-seconds if it fails.   It tries four times before giving up.  It waits up to 2 seconds if it fails 4 times.    Using this method I was able to sustain 250 concurrent users in my siege testing (without caching).  I am going to roll this out live tonight. This should reduce the problem with max connections.  Right now this is in the core code, but I will try and make a plugin out of it to save hacking the core.

I am basically trying to get all the performance I can out of the rack space cloud sites because there is no maintenance hassle with it and it is pretty cheap for the traffic I am doing. It costs me less than $250 per month in charges and overage fees to do almost a TB of traffic each month and almost 5M page views with a very complicated wordpress site.   Even with the DB issues, random outages only last about 4-5 minutes and the site is fast the whole time.  We are averaging about 99.8% uptime, which is fine for me.  It is not a bank website, just a place for coupons and online deals..  We made the db error page pretty and put lots of info on them.  Now that I am using the CDN it is even cheaper since I am not paying for RS bandwidth for all my images.

On Mar 18, 2010, at 2:22 PM, Potkanski, Jason wrote:

> Are other plugins in use, such as WP Super Cache?
> 

I am using W3 Cache, but it does not cache people who have posted a comment.  We are adding more interactive features to the site that require DB connections, but I am improving the caching. I am using wordpress Transients_API to cache elements of my side bar and footer, but  I want to make it even faster. 

> Is Squid (Caching proxy) in front of your Apache server an option?
> 

Squid is something I have not looked at.  I am using MaxCDN for the images, but not the PHP pages.

> Can the cloud site make external MySQL calls? You can create a VPS or dedicated/managed server at Rackspace to get around the 500 connection limit and point the wp-config to a server elsewhere.
> 

I tried this external site and it was too slow across their network.  They do not have a backplane to connect to their Virtual Servers.  that would be a great solutions.  The cloud sites front end with a 2 slave / 1 master DB would be pretty hot if it was faster, but there was too much latency between cloud sites and servers for me.  Also, I am really trying to stay away from Sys Admin work, and there is no managed cloud sites offering.  I have not asked about a dedicated server for DB only yet.



Thanks for all the helpful info.  I wish I had gotten on this list earlier,  this is great,

Andrew



> --
> 
> Jason Potkanski
> Tribune Technology
> 
> On 3/18/10 11:59 AM, "Andrew Gray" <andrew at graymerica.com> wrote:
> 
> Thanks for the idea, but Rackspace Cloud Sites does not let me make changes to the mysql.   Rackspace Sites is a shared LAMP stack with minimal options, but no support requirement on my end.
> 
> it is a different option then the Rackspace cloud sites, which gives you a virtual server.  All I get is FTP access and .htaccess for Apache and no real changes to MySQL.
> 
> Andrew
> 
> 
> On Mar 18, 2010, at 11:35 AM, Matt Martz wrote:
> 
>> Assuming for a minute that you are using cloud servers try downloading mysqltuner.pl and running it.  It could show you a number of settingss that you may be able to tweak to get better performance out of mysql.
>> 
>> "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
>> 
>> --
>> Matt Martz
>> matt at sivel.net_______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list