How to digg-proof your WordPress blog
Every blogger hopes to be able to say some day to his friends: “I got Dugg!”.
It means you’ve written something special that a lot of other people are interested in and it gives you a big ego boost. But there won’t be much to enjoy when your server can’t handle the extra work.
In this post I’ll try to explain some measures you can take to be ready for when “The Big Digg” arrives at your blog’s door step. I’ll focus on WordPress in particular here, because that’s what I’m using. However, the concepts I’ll show you can be applied to any web site.
There are a few things you can do to survive when you get Dugg. The key to my tips here is that you can implement them at (almost) no cost in advance of getting dugg.
It’s important to understand that once you’re blog get’s dugg, you don’t have time to install a plugin or make any other sort of change. The only thing you can do when you’re not prepared is take down your web server (including any other apps than your blog).
Trust me, you don’t want to take down your blog when you got dugg.
Another obvious constraint is upgrading hardware. You simply can’t move to a new server or upgrade your RAM when you’re getting dugg.
The key is to be prepared. Here are some tips that will help you get ready for when the day comes…
WordPress, by default, is most likely not able to survive the Digg-effect. This is mainly because every page served requires WP to query your database a few dozen times and compile it all together in that nice looking template of yours.
So, the most straight forward measure you can take to improve performance is caching. By caching your blog, you basically create static HTML files that will be served to visitors instead of the generated page mentioned earlier.
Web servers are very good at serving static files. It’s ultra-fast. Also, it reduces the load on your server because you’re database doesn’t have to be woken on every request and there’s no PHP code that needs to be executed.
Of course, your blog is dynamic (at least if you post new things occasionally). This means that you’ll need to update those static HTML files regularly to keep them up-to-date.
To implement caching in your WordPress blog you don’t have to do all that much work, really. All you need is the WP Super Cache plugin.
The plugin takes care of generating static HTML files for all your blog pages and make sure Apache (which is the most commonly used webserver for WordPress) serves these pages very fast.
Another measure you can take, in combination with caching, is compressing the static HTML files. Because compressing is a one-time action when the page gets cached, you get a very small file that can be served by your web server even faster with minimal bandwidth usage.
As you already suspect, WP Super Cache has this feature included. Nice ;-)
As an added bonus, WP Super Cache will not perform caching for logged in users, users who’ve left a comment or users who’ve accessed password protected pages. This means that if a user leaves a comment, he will not see the ‘static’ cached file (which does not include the comment yet), but the generated version of your blog with the comment.
Hardware and platform
Another, very obvious, factor to take into account is your hardware and platform.
If you’re on a shared hosting account you won’t survive a Digg. Your provider will shut down your site quite quickly. They do this because there are quite a few users (think hundreds) on the same server as your blog. When dugg, your site will take up a very large portion of the available server capacity, leaving all other users with an usable blog as well.
My advice is, if you’re serious about your blog, to host it on a VPS or dedicated server. These forms of hosting guarantee you the resources you paid for and will only cause trouble to your own web sites.
For most people a dedicated server is not an option, simply because it’s too expensive for running a sole blog.
A VPS (Virtual Private Server) can be a good compromise between shared hosting and a dedicated server. You are guaranteed a certain amount of memory, disk space and processing power and your VPS won’t interfere with other VPS’es on the same server (unless your hosting provider uses crappy VPS software. Always look for Xen VPS hosting).
The most important factor in choosing a VPS is the available, or guaranteed, memory you get. You can get ‘slices’ ranging from 128Mb up to 4Gb of RAM. For an average blog I think 256 - 512Mb should be sufficient for running Apache smoothly and handling large amounts of traffic on the static files.
I can’t help to plug SliceHost here. I recently moved Ariejan.net to a slice (a 512Mb one, I also run some Ruby on Rails apps) and I’ve been very happy with them ever since. So go buy a slice now! I’d make me happy ;-)
Anyway, it’s important to make sure you run your blog on a platform that can handle a peak in traffic and run your blog smoothly all the time.
What else? Remove all the cruft
There are a lot of nice plugins available for WordPress and there are even more ‘widgets’, ‘badges’ and ‘buttons’ you can put on your blog to show off. But every one of these will slow down the loading off your site. Especially the ones that come in the form of WordPress plugins.
The point is, add a few of these nice plugins, and you’re web server has to handle up to 15x the amount of files per page view.
Do you have any other tips?
Besides keeping your site up-and-running while getting dugg, it’s important to keep records. I personally like Goole Analytics a lot, because it gives a lot of information I haven’t seen from any other log or traffic analyzer. By gathering these statistics you can analyze later what page(s) on your blog got dugg, where all those people came from and what else they did on your site.
Another tip is: make backups! This may sound as a stupid tip to most, but you won’t believe how many people run a blog without ever making a backup. This hasn’t much to do with getting dugg, but when terror strikes, you’ll be happy to have a spare copy of all your posts and comments.
Famous last words…
Well, to test out all my tips, please digg this story to see if we can get Ariejan.net dugg for once ;-)
Thank you for reading. Cheers.
Hey! I'm a software engineer building rock solid back-end systems using Ruby, Ruby on Rails and Golang. In my free time I like to play the piano and experiment with electronics.