The story of one million checkboxes and how it managed to scale 650 million checks
- one million checkbox
- soluzione scalabili
A recent web experiment offered interesting insights into the scalability challenges that can emerge when a project unexpectedly goes viral. Software engineer Eieio created "One Million Checkboxes" (OMCB), a website with a million global checkboxes that could be selected or deselected by anyone in real-time.
Initially conceived as a small project, OMCB went viral within hours of launch, attracting tens of thousands of users and millions of interactions. This unforeseen popularity tested the site's original architecture, forcing Eieio to rapidly adopt solutions to keep the service operational.
Initial Architecture and Scalability Challenges
The basic architecture of OMCB was relatively simple:
- Nginx as a reverse proxy
- Flask server to handle API requests
- Redis for state and message queues
- WebSocket for real-time updates
As traffic increased, several issues emerged:
- Overload of Flask servers
- Exhaustion of Redis connections
- Excessive bandwidth consumption
- Frequent process crashes
Adopted Solutions
To address these challenges, Eieio implemented a series of optimizations:
- Addition of more servers and optimization of the number of Flask processes per machine
- Implementation of batching for client updates
- Use of connection pools for Redis
- Bandwidth limitation with tc (traffic control)
- Backend rewrite in Go to improve performance
Lessons Learned
This experience highlighted some key points for developing scalable web applications:
- The importance of a flexible architecture that can quickly adapt to unexpected loads
- The value of robust tools like Redis and Nginx for managing state and traffic
- The usefulness of techniques such as batching and bandwidth limiting for optimizing resources
- The advantages of high-performance languages like Go for backends under stress
Furthermore, Eieio's approach of "embracing the short term" and optimizing for quick solutions rather than perfect ones proved effective in a context of rapid growth and media attention.
The OMCB case demonstrates how even seemingly simple projects can present significant scalability challenges when they go viral. The ability to adapt quickly, use the right tools, and make pragmatic decisions proved crucial in keeping the service operational in the face of unexpected demand.
This experience underscores the importance for developers to be prepared for rapid growth scenarios, even when not initially anticipated. At the same time, it highlights how ingenuity and flexibility can enable addressing significant challenges with limited resources.
Here is the full article:
The secret inside One Million Checkboxes
Teens wrote secret binary messages in One Million Checkboxes. I found them.