by Dzidas Martinaitis

Categories

What happens when your post is top2 on HackerNews

This is what happens to your website traffic when your post makes to the front page of tech news aggregators like HackerNews and Reddit. It appears that my previous post struck a nerve, sparking extensive discussions on these platforms. In this article, I’ll share my experience, key takeaways, and, most importantly (or perhaps not at all), whether it translated into any financial gains.

Just in case you haven’t come across HackerNews - it’s not a secretive group of hackers. It’s actually a tech news aggregator that’s highly favored by tech enthusiasts. And, as the story often goes, if your content makes it to the front page, be ready for a massive influx of traffic to your website.

Luck versus skill

Luck versus skill, what is most important? Was it a lucky coincidence that my post went viral? That’s what I thought when I first shared it on HackerNews and suddenly everyone had an opinion in the comments. But then, the same thing happened on Reddit. More discussions, questions, and a bunch of shared experiences. Makes me think it’s more than just luck. I won’t lie; the post took time. It wasn’t just a quick write-up. I spent hours on the text, brainstorming ideas for the images, and doing a bunch of rewrites. Now the big question - can I do it again? I was joking with my friends that you get a credit for one viral post in your life, and if you use it up like I did, the game is over. But the response to the post shifted my thinking. Seems people on the internet still appreciate content that’s thoughtful yet fun, and either teaches you something new or throws in a different viewpoint. But I get it - my single success isn’t much of a voice, but have you heard of Mr. Beast? Believe it or not, I only learned about him recently when I listened to a Lex Fridman’s podcast featuring this viral content creator from YouTube. One key takeaway from that podcast: virality is replicable, but you need to practice the craft and believe yourself.

Scalable blogging platform

What happens when your post is top2 on HackerNews After an hour, the post made to second place

The day I shared on HN and Reddit, the average traffic went from 250 requests per day to 25,000 in a single day, excluding bot requests. My website and the infrastructure beneath survived a spike of 100x in traffic as the post remained at the top3 of HackerNews for 12 hours and 24 hours an the front page for. Now ask yourselves - can your infrastructure cope with 100x increase in traffic and much importantly, what would be the cost?

I’m lucky that, for a personal blog site, I don’t need a fancy platform; therefore, my hosting costs are close to zero. However, my approach might be unconventional. You see - my platform is static, meaning that pages are generated once, when a new post is created. Contrary to my setup, a dynamic content platform such as Wordpress, requires computational power to generate dynamic content with every query. On top of that, I write my posts in a “language” called Markdown, which gives me flexibility when it comes to formatting, be it code, formula, or just image alignment, and is a simplified version of the HTML language. To convert a post from Markdown to HTML output, I use the Jekyll tool, which, as far as I know, has only a command-line interface, putting us already into the “hackers” space for the most of the bloggers.

To summarize, this approach yields highly optimized content suitable for hosting, but its steep learning curve and perceived inflexibility might be a blocker for many.

A chain to generate and deploy the content of the website

Serverless hosting on AWS

As my website is just a bunch of HTML files, I upload them to the AWS (Amazon Web Services) platform for storage on the S3 service. This alone enables the running of a serverless website, meaning that there is no cost associated with a continuously operating computer. Additionally, AWS offers an interesting service that distributes your content globally, delivering it to recipients much faster. This becomes crucial when there’s a surge in traffic to your infrastructure — it’s not just a single point serving your content; instead, it is evenly distributed and closer to the user. Does it cost a fortune? Absolutely not—for small-scale websites like mine, AWS provides a free tier, essentially reducing the cost to nothing!

CloudFront serving around the globe While AWS does offer a free tier for its services, it’s essential to note that exceeding these limits will incur costs. I mentioned this earlier, but it’s worth emphasizing. On the second day of publishing the post, a colleague pointed out the potential costs associated with egress traffic on AWS. In simpler terms, egress traffic refers to the data that exits AWS, such as when users access your website or if you’re transferring to a different cloud provider. However, incoming data, known as ingress traffic, doesn’t come with a charge. This feedback prompted me to revisit AWS’s pricing. For the CloudFront service, you receive 1TB free, which is substantial. A rough estimate, considering my post’s size is 3MB and it’s been accessed by 50K users, suggests I’ve only used about 150GB of outgoing traffic. So, I’m well within the free limit.

While it took some pressure off, I felt it necessary to delve further into the AWS billing dashboard and the free tier page. A positive note: the billing dashboard is pretty much real-time, so what you see is likely what you’ll pay at month’s end. However, a hiccup: CloudFront doesn’t appear on the free tier page, and its metrics can only be found on the service page. Moreover, the CloudFront metrics dashboard doesn’t allow you to aggregate data transfer (egress) into a one number, e.g. for a week, but offers finer granularity. To nail down an exact figure, I had to fetch a CSV file and do the math myself. Not really customer obsessed, right?

A complicated way to check CloudFront egress

At this point, you might feel overwhelmed by the intricacy of just one service and wonder if there’s a simpler solution out there. Well, there is one – the budget alert. You can set a threshold for a specific amount, and you’ll be alerted when that limit is reached. Can things still go sideways? Of course, especially if you overlook a notification. But it’s definitely better than being in the dark!

AWS billing console and alerts

What went wrong?

With the infrastructure holding up well, there was one issue with the post. I use the MathJax library, which allows me to compile text into mathematical formulas, and it usually works very well. However, I have noticed that, randomly, the formulas were not being generated on the page, making it look ugly. It took a lot of effort to debug this issue, and it turned out that the library was declared twice in the code. Fixing a system under heavy load is not fun, but stressful. One learning from this experience is to always test your posts on different browsers.

So, we’ve discussed the technical challenges, but the main question remains unanswered: Is going viral worth it?

Benefits of a viral post

Twitter slinged You might have noticed, if you’re brave enough these days to browse without an ad blocker, that I don’t run any ads. While I’m not aiming for profit, I do mention books I’ve personally read; I wouldn’t recommend them otherwise. Thanks to a recent post, I might’ve earned enough for a new book. Yet, I found it surprising how few readers reached out on LinkedIn to connect. In the past, I expected some readers to follow me on Twitter, but I believe, sadly, that Twitter is dead. Interestingly, I received a lot of LinkedIn requests when someone shared my post to their connections. With RSS feeds slaughtered ages ago (thanks, Google) and Twitter slung recently, I don’t see a way for independent bloggers to build a persistent audience. Now, every post seems to be a hit or miss on news aggregators.