Competing Consumers
Pronunciationkum-PEE-ting kun-SOO-merz
Definition
Competing consumers means several workers read from the same queue, and each message goes to only one of them, so the work is processed in parallel and the system scales by adding workers.
Where you hear it
In job queues (Celery, SQS, RabbitMQ), background processing and scaling discussions.
Examples
Start five workers; they compete for emails in the queue.
The queue is growing, so add more consumers.
Three workers compete for the same queue, so each email is sent only once.
Common mistake
Expecting message order to be kept. With many consumers, messages finish in any order.
Don't confuse with
Pub/sub, where every subscriber gets its own copy of each message. Here each message goes to one consumer.
Say it at work
- In a meeting or chat
Scale the competing consumers on queue depth.
- In an email or ticket
Make the handler idempotent; messages may repeat.
Keep exploring
More in Architecture & Design