Bulletproof your blog: a guide for surviving traffic spikes

http://www.maxmasnick.com/articles/bulletproof_your_blog

A lot has changed since I wrote the first version of this article more than a year ago. Here are my updated recommendations.

It’s frustrating to see a story that looks really interesting on a site like Hacker News, but when you click on the link you find that the traffic surge has brought the blog down. This is probably even more frustrating for the blog’s author, who presumably has put a lot of time/effort into writing their post.

This happens more often than you might think – today, a blog post titled R, the master troll of statistical languages appeared on the front page of Hacker News. By the time I tried to read it, the WordPress-powered site it appeared on was down presumably due to the massive influx of traffic from Hacker News.

Fortunately, there are some pretty easy things you can do to prepare your website for a traffic spike. Here are some of the best ways you can build a bulletproof blog to avoid traffic-related downtime.

500 HTTP Status Cat
Your readers don't want to see this. (500 HTTP Status Cat, from girliemac on Flickr)

Easiest: Use a free blogging platform

In the previous version of this post, I recommended using the free offerings of Tumblr or Posterous. Since then, Posterous announced that they will shut down effective April 30, 2013. This means that everyone who had a blog at something.posterous.com will lose their URLs.

I think the lesson here is twofold:

  1. Always use a domain name (e.g. yourname.com) that you control.
  2. You get what you pay for. Free services are more likely to be shut down than ones you pay for.

With that said, I would still recommend Tumblr as long as you use your own domain name. Tumblr has been around since 2007, so by this point they certainly has the infrastructure to handle traffic of any scale. They have had platform-wide downtime issues in the past, but their uptime in the last 6 months is between 98 and 99%. (I would expect more from a paid service, but again Tumblr is free.)

The social features (“reblogging”) baked into Tumblr may help bring traffic to your blog. Thanks to Disqus (or Livefyre), it’s easy to add comments to your Tumblr blog.

You could use Blogger or WordPress (both free). Blogger recently received a much-needed revamp and it integrates with your Google/gmail account. (Note that the default “dynamic view” Blogger templates suck.) wordpress.com has a free option, but charges for add-ons like using your own domain name. Both do not offer the same level of customization as Tumblr.

Advantages: Free, easy, posting is quick, hosting is done for you so you don’t have to worry about dealing with traffic.

Disadvantages: If the platform goes down, there’s nothing you can do. If you want to switch platforms, you have to rely on an import/export tool or wrangle the API yourself. When they change stuff around or shut down, there’s nothing you can do about it.

Recommendations: I would recommend Tumblr over Blogger, wordpress.com, and other platforms that generally aren’t as customizable. In any case, if a blogging platform doesn’t let you use your own domain name, look elsewhere.

Alternative: I’d also keep an eye on Posthaven, which is a cheap ($5/month) platform build on a sustainable business model and the philosophy that your posts should have a permanent home. It’s not feature complete at the time of writing, but it’s usable and is gaining features quickly. The founders were former co-founders of Posterous but left because they didn’t like the trajectory of the business, so they certainly have the skills and vision to pull Posthaven off. I fully expect to rewrite this article within the next year to recommend Posthaven over any free blogging platform.

Still easy but more expensive: Squarespace

In the previous version of this article, this section was entitled “Harder: Self-host your blog” and went into great detail about the pros and cons of hosting a WordPress blog yourself, how to choose a good host, etc. You can still read about this if you want in v1, but I don’t think it’s relevant anymore.

Why? Squarespace.

Squarespace is a fully hosted, highly customizable web platform that includes support for blogging. I first heard about them this year, tried them out, and was very impressed. Their platform is the first that I’ve seen with drag-and-drop customization capabilities that parallel (and in some cases exceed) writing HTML/CSS by hand – and I say this as a web developer with 10+ years of experience. If I didn’t already know HTML/CSS, Squarespace would be the best option by far for layout and customizability. Their default themes are great too.

Squarespace goes to great lengths to ensure uptime. They offer some cool, advanced tools for developers including a Git-based system for modifying your site’s layout.

Advantages: Superb themes and customizability, nearly complete control over your site while maintaining all the reliability advantages of a hosted platform. I know both experienced developers and first-time bloggers who love using Squarespace.

Disadvantages: It costs money (starting at $8/month). You don’t have the same level of customizability as you do with some more complicated options (but it’s pretty close).

Recommendations: If you want a paid blogging platform and need more customizability than Posthaven this is your best bet.

Pro tip: there are usually discount codes that will take 10% off from sponsorships of popular tech podcasts, such as on the 5by5 Network.

Geekier: Static website

Instead of storing the content of your blog in a database, you can store it as plaintext and generate a static website. This website uses this technique: I write posts in a text editor with a formatting syntax called Markdown and then Jekyll turns these files into the website you’re viewing now.

This has a number of advantages:

  • You can write blog posts in your favorite editor and markup language.
  • You can keep your posts in version control or Dropbox to synchronize them between computers and back them up.
  • Servers for static websites are essentially free. Github will host your Jekyll site for free, or you can use a static NearlyFreeSpeech.NET site or Amazon S3 account for negligible storage and bandwidth fees.
  • If your host is reliable, your site will never go down and will easily survive traffic spikes – because all your content is static, requests are handled very quickly.

However, you have to be comfortable in the command line for a static site to practical. You also have to rely on client-side Javascript for any dynamic content (e.g. blog comments or displaying your Twitter feed).

Using a static site generator is becoming more and more common among people in the tech industry. Amazon.com’s CTO, Werner Vogels, uses Jekyll and S3 (like this website). Marco Arment, the creator of Instapaper, uses a custom-written static site generator called Second Crack. Paul Stamatiou wrote a long post about switching his blog from WordPress to Jekyll.

If you’re just getting started with Jekyll, take a look at Octopress. It’s a framework on top of Jekyll with a bunch of useful features, such as theming, Octopress-specific plugins, syntax highlighting for code, and more.

Advantages: Hosting is virtually free, complete control over writing environment, easy to back up and search locally.

Disadvantages: Not for the non-geeky. You can only post from a computer where you have your static site generator set up. No ability to do dynamic page generation.

Recommendation: Unless you have some programming or web development experience, static site generation is probably not for you. If you are a hacker, this can work great.

Alternative: There are also some services that will allow you to publish a blog using Markdown files you save in Dropbox. Scriptogram is one such service that produces very nice-looking blogs. This Markdown->Dropbox->blog setup is intriguing as it gives you some of the advantages of a Jekyll site without all the geekery. However, I’d only use one of these services if you can bring your own domain name – many are relatively new and could shut down at any time (Scriptogram does let you use custom domains).


Comments? I'm @masnick on Twitter.