Static Sites for Fun and Savings


2013-04-28

Your blog probably doesn't need a database. It probably doesn't need server-side code execution. So why do you slow it down with such unnecessary functionality? And why pay for the resources? Your blog could be static files and accomplish the same goals. And, actually, this applies to more than just blogs. There are tons of sites using a dynamic web framework or executing code for every pageview that could easily be served through plain old static HTML.

For a long time, I would bounce around hosted site solutions (blogger, tumblr, wordpress.com). Then I went to writing and hosting my sites myself with web frameworks (wordpress, flask) or plain php. Then I realized that the only dynamic thing on my most of my sites (these are either editorial or how-to sites) was the comments section. The comments are either not useful and deserted or can be served easily by Disqus' JavaScript comment service. So if you think your situation is a lot like mine, read on.

Converting to static sites is pretty easy, especially if you use a static site generator. I built my own, but there are many out there that are quite popular: Jekyll, Hyde, Pelican, etc.

My favorite reason to have a static site is the sheer amount of resources you can cut out of your stack. I am running multiple sites (including this one) on a VPS with 128 MB of RAM, with no caching yet (CentOS 6 and nginx). And it's only costing me $10 a year. Some might say that it wouldn't be able to handle much traffic, but a few days ago this site received 5,269 pageviews within just a few hours and up to 150 concurrent visitors at one time as you can see above.

The VPS was using less than 70 MB of RAM and never broke 0.06 for a five-minute load average. So if you're using a beefy VPS from Linode or similar, you might be killing a fly with a sledgehammer.