Tutorials System Design Mastery
Message Queues: RabbitMQ vs Kafka vs Azure Service Bus
On this page
Mastering Message Queues
In a high-scale system, different services shouldn't talk to each other directly (Synchronous). They should talk via a Message Queue (Asynchronous). This decouples your services and prevents a failure in one from crashing the others.
1. RabbitMQ (Traditional Queue)
Messages are sent, processed, and then deleted. It is smart—it tracks which consumer has which message. Best for: Task processing, PDF generation, and simple asynchronous jobs.
2. Apache Kafka (Log-based)
Kafka is more like a "Distributed Log." Messages are not deleted after they are read. Consumers can "Rewind" and re-read history. It can handle trillions of messages per day. Best for: Data analytics, streaming logs, and massive event-driven systems.
3. Azure Service Bus (Enterprise Grade)
Provides cloud-native features like **Sessions**, **Transactions**, and **DLQs** out of the box. It is the gold standard for .NET enterprise architectures.
4. Interview Mastery
Q: "What is the 'Backpressure' problem in queues?"
Architect Answer: "Backpressure occurs when the Producer is sending messages faster than the Consumer can process them. The queue grows until it runs out of memory/disk. To fix this, we: 1) **Scale the Consumers** (more workers). 2) **Throttling**: Tell the producer to slow down. 3) **Drop Policy**: Start discarding low-priority messages. A resilient system must have a strategy for when backpressure becomes critical."
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!