Monday morning (USA time) 31st October 2016, at a certain point my post about “Surface Book vs MacBook Pro” got the first position on Hacker News. It triggered a good amount of discussion, and luckly the tech-savy people commenting managed to go on using either the Google cache or directly reading from the RSS feed (which is distributed via feedburner, thus static)
How did I notice it? Because someone wrote me on facebook that my site was down. The error I got was:
Going to page linked from the error, Azure SQL Database resource limits, looks like the problem is that I reached the maximum number of workers allowed by my SQL Basic Tier (30).
Also DTUs were maxed out, according to the resource chart from azure portal.
All these was due to the huge number of requests arriving from Hacker News, more than 40k per hour… with more than half of the response returning HTTP errors. Normally I have less than 500 per hour, so a huge peak.
I’m running on Azure thanks to my MSDN subscription, which entitles me to 130 Euro per month to spend on Azure. So I had a Standard tier for the Web and a Basic tier for SQL Server. And at the time I set them up this was almost maxing out my budget. I realized lately I was just using less than 40€ per month, so I upgraded the SQL server to the Standard tier, which has 60 workers and 10 DTUs. Unfortunaly it took 3-6 hours to scale up a database (even if mine is pretty small, less than half gigabytes). So I guess I lost the traction of the first visits from Hacker News. I would have expected Azure to allows sporadic peaks (I’m usually at half DTU all year long, and for the 3 hrs I’m above the limit they shut it down?).
What did I learn?
Short term solution, thanks to some suggestion from some friend, I setup my site under CloudFlare. It is a kind of CDN which caches my website and serves it up to the world. It caches only static files (js, css, images) but by default it doesn’t cache dynamic pages, so I’ll have to understand how to configure it to cache them and also keep the backend outside and update pages after comments have been added.
Longer term solution: Move away from Subtext and from Azure. This was already something I was planning to do since my MSDN license was a benefit of being MVP. And not making any money out of my blog (apart from the sporadic 5-10SUSD a month I get from ads) I can’t afford to spend 50€ a month on Azure fees.
I’m evaluating some options for the new home of my blog: one is making everything static, and host it on github pages. Another is migrating to another blog engine built with Umbraco, Articulate, and run it from Umbraco Cloud.