Back to Catalog
Integration
Messaging Endpoints
Competing Consumers
Multiple consumers race to process messages from one queue — automatic load balancing and scale-out.
Intent & Description
Real-world Use Case
Image resizing service — all image resize requests land on one SQS queue. 20 Lambda functions compete for messages. AWS distributes load automatically. During a marketing campaign spike — Lambda auto-scales to 200 instances. No code changes, just scale.
Source
📌 TL;DR
Competing Consumers = run N copies of your consumer, point them all at one queue. Auto load-balanced, automatically fault-tolerant. The simplest way to scale message throughput horizontally.
Advantages
- Trivial horizontal scale-out — add more consumer instances
- Automatic load balancing by the broker
- Fault tolerance — if one consumer dies, others keep processing
- No coordination code needed in consumer logic
Disadvantages
- Message ordering is not guaranteed — competing consumers process in parallel
- Requires Idempotent Consumer if broker delivers duplicates (at-least-once)
- Shared queue can cause hotspot issues if messages are not evenly processable
- Consumer scaling decisions still need a trigger (queue depth metric, CPU, etc.)