📅 Week 5 of our 254-Day Hands-On System Design Journey
🎯 Today's Mission: Transform your consumers from toy projects to production-grade systems
Yesterday you built consumers that eagerly grabbed logs from queues and processed them. But here's the thing - what happens when your consumer crashes mid-processing? Or when the database is temporarily down? In production systems, failure isn't an exception; it's Tuesday.
Today we're adding the safety nets that separate toy projects from production-grade systems: consumer acknowledgments and redelivery mechanisms.
🍽️ The "Restaurant Order" Mental Model
Imagine you're a waiter in a busy restaurant. When the kitchen gives you an order, you don't just grab it and disappear. You either:
Confirm you delivered it successfully ("Ack" - acknowledgment)
Return it if something went wrong ("Nack" - negative acknowledgment)
Message queues work exactly the same way. Your consumer needs to explicitly tell the queue: "I successfully processed this message" or "Something went wrong, please try again."
💡 Why This Matters in Real Systems
At Netflix, a single failed log message could mean losing critical user viewing data. At Uber, it might mean a driver doesn't get paid. At Amazon, it could result in lost orders.
The difference between amateur and professional systems? Professionals assume failure and plan for it.
🏗️ The Architecture We're Building Today
GitHub Link:
https://github.com/sysdr/course-p/tree/main/day34

