# Competing Consumers

> A design pattern in which several consumers read from one queue, and each message goes to only one of them.

Record: `architecture:competing-consumers`
Kind: pattern
Layer: [Execution Core](https://banes-lab.com/records/layer/execution-core.md)
Severity: contextual
Scope: service, messaging, scalability
Canonical: https://banes-lab.com/ontology#architecture-competing-consumers

Listed in [Architecture principles](https://banes-lab.com/api/records/architecture.md), after [Idempotent Consumer](https://banes-lab.com/records/architecture/idempotent-consumer.md) and before [Defensive Programming](https://banes-lab.com/records/architecture/defensive-programming.md).

## Repair

- Refactored by: Scale Out Competing Consumers
- Detected by: queue depth rising with a single processor
- Violated by: one consumer serially draining a growing backlog
- Measured by: consumer utilization vs backlog growth
- Enforced by: messaging design review

## Requires

- [Message Queue](https://banes-lab.com/records/architecture/message-queue.md)

## Reinforces

- [Horizontal Scaling](https://banes-lab.com/records/architecture/horizontal-scaling.md)
- [Load Balancing](https://banes-lab.com/records/architecture/load-balancing.md)

## Enables

- [Parallel Message Processing](https://banes-lab.com/records/lexicon/parallel-message-processing.md)
- [Consumer Elasticity](https://banes-lab.com/records/lexicon/consumer-elasticity.md)

## Conflicts with

- [Single Serial Consumer](https://banes-lab.com/records/lexicon/single-serial-consumer.md)

## In tension with

- [Ordering](https://banes-lab.com/records/lexicon/ordering.md)

## Tensions

- [Competing Consumers / Ordering](https://banes-lab.com/records/tension/competing-consumers-ordering.md)

## Severity

- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)

## Category

- [Event / Messaging / Asynchronous Architecture](https://banes-lab.com/records/architecture-category/event-messaging-asynchronous-architecture.md)

## Linked from

- [Event / Messaging / Asynchronous Architecture](https://banes-lab.com/ontology/principles/architecture-category-event-messaging-asynchronous-architecture.md)
- [Scalability / Performance / Optimization](https://banes-lab.com/ontology/principles/architecture-category-scalability-performance-optimization.md)
- [Event Messaging Async](https://banes-lab.com/ontology/lexicon/lexicon-category-event-messaging-async.md)
- [Quality Attributes](https://banes-lab.com/ontology/lexicon/lexicon-category-quality-attributes.md)
- [Severity levels](https://banes-lab.com/ontology/schema/the-vocabulary-severity.md)
- [The resolutions](https://banes-lab.com/ontology/schema/the-resolutions.md)
