Last week my keyboard prank post was promoted to the front page of Digg and within minutes my WordPress blog was down for the count. Being slightly embarrassed I tried get my site back online and along the way found several things you can do to prevent this from happening to you!
NOTE:
I do not claim to be an expert on this subject. If you have more insight or suggestions please post a comment here.
MySql
Most times it’s the MySql database that’s the problem. All your blog entries are stored, managed and retrieved from a MySql database, and, by default MySql doesn’t allow more than 100 connections at a given time. So if you’re getting pounded by the entire world, most of your viewers will see an error page
Luckily there is an easy solution (if you manage your own server): just increase the number of connections MySql supports. Open your MySql configuration file, in my case it was at /etc/my.cnf, and set ‘max_connections’ to any number you want; I set it to 250. Now don’t forget to restart MySql after this change.
WP-Cache
MySql is only part of the issue — why abuse your database server if you don’t have to? WP-Cache is a WordPress plugin that caches your posts to static HTML files to save your database and server cycles.
This saves your MySql server by keeping the number of connections to a minimum. Also since WordPress is written in PHP, which is an interpreted language that must be parsed each time a page is requested, caching the pages as HTML saves your web server cycles and speeds up the load time for your viewers.
By default the cache is used for an hour until it’s expired and refreshed with new content. Since I wanted to view the recent comments quicker than that I changed the expiration time to 4 minutes (or 240 seconds). To change this click Options > WP-Cache and change the expire time value and then click ‘Change Expiration’. Be sure to read the WP-Cache instructions on how to install and configure it.
Mirroring
These steps are all fine and good, but what if your server can’t handle the traffic or you don’t have the administrative rights to make the necessary optimizations? At this point you’ll want to mirror blog post before it gets submitted to Digg or Slashdot. The reason I stress this is if you wait until your site is down, it’s too late.
Mirroring your content only takes a single click with the Coral Content Distribution Network. Coral works like a P2P network and as soon as your link is submitted on their website, it’s mirrored around the world across 260+ servers. To start, go to their website and enter your URL in the form (under Using Coral) and click ‘Go’. This will open a new window and show you your mirrored page (this may take a minute).
It’s important to note that Coral does have a bandwidth limit on the URLs it mirrors, so it might be a good idea to create a couple more mirrors through Coral. You should be able to do this by adding a unique parameter to your URL; I did it this way:
- http://mozmonkey.com.nyud.net:8090/2006/april_fools_hack/
- http://mozmonkey.com.nyud.net:8090/2006/april_fools_hack/?mirror2
- http://mozmonkey.com.nyud.net:8090/2006/april_fools_hack/?mirror3
Now, when you post to Digg or another high traffic website you can include these mirror URLs as the one of the first comments.
Apache
If you’re running your site through Apache you probably wont need to tweak it much — the only thing I did was set MaxClients to the max (256). For more information about Apache optimizations checkout the Apache Performance Notes. This article has some simple changes you can make to help squeeze the most out of Apache.
Advanced Options
If you want to know more advanced optimizations checkout High Performance WordPress. This article goes into great detail about how WordPress works and many more things you can do to optimize it.
[…] Jeremy Gillick (software engineer and cool prankster) says: Last week my keyboard prank post was promoted to the front page of Digg and within minutes my WordPress blog was down for the count. Being slightly embarrassed I tried get my site back online and along the way found several things you can do to prevent this from happening to you! […]
Phuket, travel, thailand, tsunami, hotel, resort, holiday, phuket hotel thailand hotels news online.
Happy New Year To ALL
That was interesting. Check out Jimmy Dushku’s site at http://www.JimmyDushku.com
Great post. I´ll think about that.
[…] Optimizing WordPress for High Volume Traffic […]
Hey! Thank you very much! Comes in handy for me!
[…] http://mozmonkey.com/2006/optimizing-wordpress-for-high-volume-traffic/ […]
Thanks Jeremy,
Good advice thank you for that, I just might need it someday.
Cool site. Keep posting. A++++
[…] Optimizing WordPress for High Volume Traffic […]
[…] Optimizing WordPress for High Volume Traffic […]
the wp cache script saved Sciencetext from a major drubbing this week. For some reason a fairly obvious post about how to use your GMail account as a virtual hard drive got Stumbled. Amazing how many people hit the site all at once…it would have pushed us over our CPU allowance very quickly indeed without wp-cache
db
[…] 原文:mozmonkey.com 译者:peterzsk 译文原地址:http://zsk.akaka.com.cn/2007/06/high-traffic-for-wordpress/ 采用CC创作共用协议,转载可保留以上信息并。 […]
博客
[…] mirroring. You can keep your WordPress blog from going offline by employing mirroring. Mirroring your content is very simple’ just sign up for a system like Corel Content […]
Very good information. I also installed wordpress but later I left it as you said mysql has many limitations.
it’s painful to get to know the limitations of your applications and servers. there are some other things you can do to help WordPress move faster. One is to utilize a php accelerator. it’s a little involved for the novice, but really helps. another thing you can do is to make sure mysql is caching. that will help too. good post.
You can also outsource to low cost content delivery networks (CDN). More SEO friendly and sometimes with better performance than Coral.
Yes wordpress is a very useful blogging software however it has some limitations and most important is it is slower than classical html pages.
and servers. there are some other things you can do to help WordPress move faster. One is to utilize a php accelerator.
Nice Tip. Thats very helpful, I wondered why my views were getting error pages.
Thanks
[…] Optimizing WordPress for High Volume Traffic […]
I have been using the hell out of WP-Cache… what a life saver! Great advise… thanks!
is there any downside to increasing the max users for mysql database?
thanks for this article.
@K Stone
I’m not really sure. If you increased it too much it could use all your ram or CPU cycles. I’m not sure what the magic number is.
Here’s some more good information on the subject:
http://www.itslot.com/calculate_mysql_memory
Mine is set to 250, which has worked well for me.
Thanks for the info.
Do you know what the Coral bandwidth limit on the URLs it mirrors is?
[…] Optimizing WordPress for High Volume Traffic […]
[…] 原文:mozmonkey.com 译者:peterzsk 译文原地址:http://zsk.akaka.com.cn/2007/06/high-traffic-for-wordpress/ 采用CC创作共用协议,转载可保留以上信息并<署名、非商业和保持一致>。 […]
I also use wordpress and this information is very useful. I don’t add my site on any social bookmark yet but maybe in the future.. who knows…
That really helped friend.. its very informative.Thank you
By default the cache is used for an hour until it’s expired and refreshed with new content. I was not aware of this. We are now optimizing our site accordingly. Thanks!
[…] 2. http://mozmonkey.com/2006/optimizing-wordpress-for-high-volume-traffic/ […]
First of all congratulation for such a great site. I learned a lot reading article here today. I will make sure i visit this site once a day so i can learn more.
[…] Optimizing WordPress for High Volume Traffic […]
Backlinks are the most effective way to increase you pagerank Google loves them and they mean your website is popular the more backlinks you have
[…] http://mozmonkey.com/2006/optimizing-wordpress-for-high-volume-traffic/ […]
What about tag pages? I’m finding that alot of my traffic is coming from tag pages. I didn’t see any settings for true/false with regard to tag pages. Thx.
We have posted answers to your comments in a new post this morning. We are also getting in touch with some of you to get suggestions and further feedback.
@polak thats not how it works 🙂
By default the cache is used for an hour until it’s expired and refreshed with new content. I was not aware of this. We are now optimizing our site accordingly. Thanks!
HTML pages are faster than wordpress, every application has its limitations.
I am using WP Super Cache and my site loads a bit faster but still to slow, don’t know where the problem is..
WordPress is not the best for high traffic joomla is more user friendly and so is drupal as long as you know how to use it properly.
So I’ve finally gotten my act together and updated the design of shelktone.com I’m now on WordPress and I believe there are no more broken links. Exciting!
Let me know what you think of the new design and if you have any suggestions. Thanks!
[…] http://mozmonkey.com/2006/optimizing-wordpress-for-high-volume-traffic/ […]
This is a good subject to talk about. Sometimes I fav stuff like this on Redit. This article probably won’t do well with that crowd. I’ll take a look around your site though and submit something else.