Yesterday, my WebAssembly 101 tutorial hit a pretty sweet spot on Hacker News, raising to the #1 one and getting more than 500 points.
If you read Hacker News, you've probably seen many websites go down when they hit the front page, with people resorting to Google cache, when available, to access the content.
So when I saw that my submission started appearing on the front page after 6 or 7 upvotes (yes that's all you need!) I had a moment of doubt and went straight to Google Analytics to see how much traffic was coming. Answer: a lot !
Google Analytics five minutes after hitting the frontpage:
Sure, this is a first world problem but I never had so much traffic, my website isn't a static one, I wasn't using a CDN and I had no idea how my server would handle the load.
The Ghost platform hosted on Heroku
I'm hosted on Heroku on a single free dyno, you can't really get a smaller instance. So, how did it perform ?
To my surprise I didn't even had to scale up my app ! My sole instance flawlessly served all the requests without a single error.
At a mean of 235rpm day, we get:
235rpm.day x 60min/hour x 24hr/day = 338400 requests
At 7 requests per page for openbloc.fr (that could surely be optimized)
we get ~48000 pages viewed.
The traffic peaked at ~650rpm, or ~100 pages per minute but the CPU usage didn't go over 20% and the RAM usage as 250MB.
How to benchmark your site ?
A cool tool is Apache Benchmark. On Ubuntu you can install it with:
$ sudo apt install apache2-utils
And then to request 100 pages, 10 pages at a time:
$ ab -n 100 -c 10 http://www.example.com/you-post-url/
If it takes less than a minute to complete you should be on the safe side :)
That's it !
How many people use an ad-blocker ?
Beware that the Hacker News audience is pretty tech-savvy so we should get a higher percentage not representative of the general population.
I guess I'll ask Google Analytics how many people don't use an ad-blocker ;)
27677 page viewed says GA, 48342 says my server, so I'll say:
- 43% use an ad-blocker,
- 57% don't.
I spent a lot of time hacking this weekend to get the WebAssembly 101 tutorial possible so I knew the content could be interesting for someone starting in WebAssembly but I would never have expected such a success, it's really overwhelming !
On a personal note, after having gone through some rough times at the beginning of this year, it feels good to be back on track !
Happy hacking !