The Switch To Hexo
This is a minor note about a major change in thinking. For a while now, i’ve been running a site that is mostly static on Wordpress. Not a surprise to most since there are estimated to be more than 74 million Wordpress sites as of Feb 7, 2014.
However, it occurred to me that Wordpress is built more for the site administrator than it is for the end-user. If you are lucky, you have a very high ratio of visitors to administrators for your site. To serve the site admin, you are running PHP against a MySQL database to generate the same content all the time.
This means that each page visited by a user for the first time requires a number of database hits and reasonably high amount of CPU (relative to the task being performed) to generate the page on the fly for that user.
But what about browser caching you say? That works if you have a lot of repeat traffic, but if you have a high number of first time visitors you still have a lot of effort going on to crank out the same page over and over again.
I’d wager to say that if Henry Ford had built cars the same way that Wordpress generates the same page we might have a problem.
So, i’ve switched to a static-site generator called Hexo for my blog. The idea is to build the parts of the site in advance and use as little resources as possible to host it.
My site is now hosted in an S3 bucket on AWS and generated dynamically exactly once using Hexo before the static files are deployed. This means that I can use the least expensive technology to host the site. Of course, on a small scale no one will notice, but as usage grows, costs are managed nicely and the site stays blazingly fast! Now I have to work on finding users who are impressed by static-site generators!
An interesting thought that naturally follows is the idea of putting your static content and javascript in an S3 bucket and use CORS-approved AJAX requests to an AWS API Gateway/Lambda backend to have an extremely low-cost but very scalable web application.
Stay tuned to read more articles on scalable web application design.