How to make sure your blog survives the Digg Effect
On January 20, our article Where NOT to keep your servers according to Mother Nature hit the number one spot on the front page of Digg.
Looking at the bandwidth graph below, you can clearly see the traffic spike when we hit the first page of Digg. Or perhaps we should say when Digg hit us…
The traffic from the Digg front page (or Slashdot’s front page, for that matter) has been known to bring down entire sites. Fortunately we had taken some simple measures to make sure that we could survive a large traffic spike such as this. It’s not rocket science but we decided it might be worthwhile sharing what we did.
So, how do you make sure that your blog survives a really big spike in the number of visitors? There are basically two things to think about: Server load and bandwidth.
Reducing server load
Wordpress, our blogging software, makes heavy use of PHP and MySQL, which can easily bring a server to its knees during the kind of traffic spike that Digg brings in. To get around this bottleneck we have installed a caching system for WordPress called WP-Cache 2.0, which works extremely well and can effectively speed up page delivery by a factor of 100 or more.
From the WP-Cache page:
WP-Cache is an extremely efficient WordPress page caching system to make your site much faster and responsive. It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and then building the page from the database.
We also further reduced the load on the server by temporarily disabling a statistics program we are using.
Before we turned the caching on, MySQL was taking a heavy toll on our server (see “top” command below). Once we activated caching, the MySQL load almost disappeared entirely and the Digg effect was not a problem.
Reducing bandwidth demands
Most of our images are hosted on Flickr, which reduces the bandwidth needed to serve pages from the blog (thank you, Flickr). This is a very simple solution but works extremely well, especially if you have a blog that makes heavy use of images.
Always have a Plan B
If all else failed we also had a static page with just the article text prepared. If the load on the server became too high we would have switched over to use this, basically replacing the WordPress blog entirely with one single HTML page containing the article. This would have made the rest of the content unavailable, so it should really only be used as a last resort. Thankfully enough it never came to this, as the caching system we had in place worked great and kept the load on the server to a reasonable level.
All in all, ending up as number one on the Digg front page was an unequivocally positive experience. We had no server or bandwidth problems thanks to the simple but effective setup we had put in place, and though perhaps not suitable to everyone, we hope that this advice can help at least some of the other bloggers out there.