How my Docker-Powered Website Handled Hacker News

How my Docker-Powered Website Handled Hacker News

Life tends to sit in the corner, waiting to catch you off guard. Much like my infant son, he waits till I'm out of arms reach to try one of his kamikaze moves, ending 9 times out of 10 in a face plant. However, my Docker-powered Ghost Blog was ready for the challenge.

Recently, My Docker Alpine Post went quasi-viral in the tech news universe. A random person submitted the article to Hacker News, and then the story proceeded to the Top 4 on Hacker News and the Top Story of Slashdot and was covered by several Linux publications after the submission. All this kicked off while I was counting containers while sleeping.

This website's typical traffic usually is between 200 to 300 visitors a day. On February 6th, when my site hit HN, a free hamburger-type mad rush of visitors showed up, peaking at 30,000 visitors in less than 24 hours.

This Blog is running a single Ghost Docker container on a Digital Ocean droplet that has 2GB of RAM with 2 CPU's. In front of the Blog is the free CloudFlare CDN services which does a great job of not only providing free SSL and better performance but also threat mitigation.

Docker Ghost Blog Performance

So, how did this small Blog handle such a rush of visitors? Surprisingly, quite well. I was a bit shocked. Not only did it stay up the entire time, but it also continued serving pages at consistent speeds.

CloudFlare Statistics for Hacker News
CloudFlare Statistics

It appears CloudFlare took a major load off my server by serving up cached copies. However, I did notice a large discrepancy between the analytics in CloudFlare and Google Analytics of around 10,000 users. So of course I will use the large number until I figure out who is correct.

The load on the actual Digital Ocean droplet was running just above idle as seen in the graph below. The CPU reached a whopping 6% utilization at its peak.

Digital Ocean CPU Performance
Digital Ocean CPU Performance

The bandwidth logs were the only accurate indicators of the traffic spike. But even in the grand scheme of things, it was barely a blip on the radar.

Digital Ocean Bandwidth and Disk Performance
Bandwidth and Disk performance

The amazing simplicity of this setup proves that it can and will handle traffic spikes. Unlike WordPress, where it is recommended to install X number of plugins to do caching, image optimization, SEO, etc., my previous high-level traffic events on WordPress sites made all my hair fall out.

My previous WordPress installations chewed through Memory, and the plugins were a pain to configure and keep updated and always ended in tears.

Ghost just runs right out of the box combined with Docker enables a truly flexible and durable solution.

Lessons Learned

If I had known ahead of time that I would receive such a burst of traffic, I would have prepared the following:

  1. Newsletter - Someone emailed me, complimented me, and complained to me simultaneously. They informed me that they enjoyed my content but found it hard to subscribe or stay updated on new articles. Hence, I added a Newsletter section in the sidebar and footer and created an initial Newsletter pop-up. But this was only changed on the downside of the spike. Doh!
  2. About Page - I started digging through my analytics and found a lot visitors click through to the About Page but abandoned shortly after. I shortened my about page considerably, added my DockerCon Video and added social links and contact info. Afterwards, visitors not only stayed on longer but they transitioned on to other pages.
  3. Contact Page - Another page on which I noticed traffic without action. This page used to contain a Google Form for my contact page. I have since deleted it and added my social contacts and a direct email link. This appears to work much better, and my blog's number of emails has increased. Not sure if this is a good thing :)

Next Steps

I still have many articles in the queue that I need to research and write, ranging from Docker Image best practices to why air travel continues to decline and not get better with technology.

Also on the ToDo list is the building of a monthly newsletter. The newsletter will cover all the interesting projects I stumble across or am working on, books I'm reading, and some general TIL (Today I Learned) information. If you're interested, sign up here in the sidebar or footer.

FAQ Section: How Docker and Ghost CMS Survived Front Page of Hacker News

What is Ghost and how does it work with Docker?
Ghost is a popular, open-source blogging platform designed for simplicity and performance. When used with Docker, Ghost can be easily containerized, allowing for streamlined deployment and management. Docker provides a consistent environment for running Ghost, making it easier to scale, backup, and manage your blog.

How can I deploy Ghost with Docker?
To deploy Ghost with Docker, you can use the official Ghost Docker image. Simply create a docker-compose.yml file with the necessary configurations for your database and Ghost service. Then, use the docker-compose up -d command to start your Ghost instance. This approach allows you to deploy Ghost quickly with all dependencies handled by Docker.

What are the benefits of running Ghost in a Docker container?
Running Ghost in a Docker container offers several benefits, including ease of deployment, consistent environments across different machines, simplified updates, and scalability. Docker containers isolate Ghost from the host system, reducing potential conflicts and making it easier to maintain and scale the blog as your traffic grows.

Can I scale my Ghost blog using Docker?
Yes, you can scale your Ghost blog using Docker by utilizing Docker Compose or a Docker orchestration tool like Docker Swarm or Kubernetes. These tools allow you to run multiple instances of Ghost, distribute traffic, and manage resources effectively, ensuring your blog remains fast and responsive even as traffic increases.

Follow me

If you liked this article, Follow Me on Twitter to stay updated!