Review & Cheat Sheet
[!IMPORTANT] In this lesson, you will master:
- 🧠 Interactive Flashcards: Rapid-fire testing on Fanout, Idempotency, and Zero-Copy mechanics.
- 📝 Whiteboard Summary: A 4-quadrant reference for system design interviews, covering core concepts to advanced Kafka trade-offs.
- 🕵️ Interview Gauntlet: 50 targeted questions ranging from Apprentice to Architect level.
1. Interactive Flashcards
Test your knowledge. Click (or tap) the card to flip it.
2. Elite Messaging Decision Tree
When designing a system, use this logic to pick your communication hardware pathway.
Need to Decouple Services?
YES (Asynchronous)
One-to-Many?
YES
Pub-Sub / Kafka
NO
Queue (SQS/Rabbit)
NO (Synchronous)
Real-time Streaming?
YES
gRPC / WebSockets
NO
REST API
3. Whiteboard Summary
Use this grid to recall the entire module during an interview.
1. Core Concepts
- Asynchronous: Fire & Forget.
- Decoupling: Producers unaware of Consumers.
- Backpressure: Handling load spikes.
- Durability: Persisting messages to disk.
- Event Driven: Reacting to state changes.
2. Patterns
- Queue (1-to-1): Work distribution.
- Pub-Sub (1-to-Many): Fanout / Notification.
- Dead Letter Queue: Handling poison messages.
- Idempotency Key: Safe retries.
- Transactional Outbox: Atomic DB + Msg.
3. Kafka Deep Dive
- Log Abstraction: Append-only file.
- Partition: Unit of Scalability.
- Consumer Group: Parallel processing.
- Zero Copy:
sendfile()optimization. - ISR: Replication reliability.
4. Trade-offs
- Push (Low Latency) vs Pull (Control).
- FIFO vs Partition Ordering.
- At-Most-Once vs At-Least-Once.
- Throughput vs Latency (Batching).
4. Interview Gauntlet
Can you survive 50 rapid-fire questions?
Level 1: Apprentice (Basics)
- What is the main difference between a Queue and a Topic?
- Why do we need message queues in Microservices?
- What happens if a consumer crashes while processing a message?
- What is a Dead Letter Queue (DLQ)?
- What does FIFO stand for?
- Explain “Decoupling”.
- What is a “Producer”?
- What is a “Consumer”?
- What is RabbitMQ?
- What is Amazon SQS?
- Is HTTP synchronous or asynchronous?
- What is “Polling”?
- What is a “Visibility Timeout”?
- Why is tight coupling bad?
- What is vertical scaling vs horizontal scaling?
Level 2: Engineer (Patterns)
- What is the difference between Push and Pull models?
- How do you handle “Thundering Herd” in a Push system?
- What is “Fanout”?
- What is the difference between a Fanout and a Direct exchange?
- Why is Idempotency important in messaging?
- How do you implement Idempotency?
- What is “At-Least-Once” delivery?
- What is “At-Most-Once” delivery?
- Why can’t we easily guarantee “Exactly-Once”?
- What is a “Race Condition”?
- How does Redis help with Idempotency?
- What is a “Soft Delete”?
- How do you handle message ordering in a scaled system?
- What is “Backpressure”?
- How does a Circuit Breaker relate to Messaging?
Level 3: Architect (Kafka & Deep Dive)
- What is a Kafka Partition?
- How does Kafka guarantee ordering?
- What is a Consumer Group?
- If I have 10 partitions and 20 consumers, what happens?
- What is “Zero Copy”?
- Explain “Sequential I/O” vs “Random I/O”.
- What is an ISR (In-Sync Replica)?
- What is
acks=all? - How does Kafka support Transactions?
- What is Log Compaction?
- What is the difference between RabbitMQ and Kafka storage?
- How do you reprocess dead letters automatically?
- What is “Head of Line Blocking” in queues?
- How does Partitioning affect Latency?
- What is “Skew” in partitioning?
- How do you choose a Partition Key?
- What is “Consumer Lag”?
- How do you monitor a Kafka cluster?
- What is the “Transactional Outbox” pattern?
- Design a system to count YouTube views in real-time.
- Explain the hardware cost of “At-Least-Once” delivery.
5. Hardware-First Messaging Checklist
Before you deploy your broker, verify these physical limits:
- Disk IOPS: Is your “Persistent” queue saturating the SSD’s random-write limit?
- Page Cache Utilization: Is your consumer lag pushing reads out of RAM and onto the Physical Disk (Tail Latency Cliff)?
- NIC Saturation: Is your Fanout ratio (1 to 100) exceeding the 10Gbps/100Gbps network backplane capacity?
- Context Switch Overhead: Is your high-concurrency RabbitMQ cluster spending more time in Kernel-mode (interrupts) than processing messages?
6. Staff Engineer Challenge: The “Infinite Retry” Storm
The Scenario: A downstream database is down. You have 1,000,000 messages in your Main Queue.
- The Bug: Your consumer code has a retry loop with no backoff.
- The Hardware Impact: The messages are being redelivered at 100k/sec, saturating the Broker’s CPU and disk.
The Question: How would you implement a Hardware-Aware Backoff?
- Would you use a Retry Queue with TTL?
- Or a Jittered Exponential Backoff in the consumer?
- How do you prevent the “Synchronous Disk Flush” from locking up the broker while handling these retries?
7. 🔗 Next Steps
- Next Module: Module 09: Coordination
- Practice: Head over to the Problem Vault to practice Messaging integration problems.