← System Design learning pathSystem Design · Module 6 of 10
Messaging and asynchronous processing
Decouple services with queues and events.
📖 Key ideas
- Message queues (RabbitMQ, SQS) hold tasks for workers.
- Event streams (Kafka) publish events to many consumers.
- Async processing handles slow tasks (emails, video encoding) in the background.
- Queues smooth traffic spikes.
- Design for retries and idempotency.
💡 Real-life example: A message queue is a restaurant ticket rail: orders wait their turn instead of overwhelming the cook.
Message queueBuffer of tasks for workers
Event streamOrdered log of events
Producer/consumerSender and receiver of messages
IdempotencySafe to process twice