Degraded

Kafka consumer lag: when consumers fall behind producers

Consumer lag is the number of messages written to a topic that the consumer group has not processed yet. Growing lag means consumers are slower than producers.

What causes it

Lag follows a simple rule: each second it grows by messages produced minus messages consumed. Consumer throughput is capped by parallelism, and in Kafka parallelism is capped by the partition count — a topic with 6 partitions can have at most 6 consumers working at once, so the seventh sits idle.

How to recognise it

The math

B(t+1) = max(0, B(t) + produced − consumed); parallelism ≤ partitions

How to fix it

Reproduce it in the simulator

These templates trigger this failure on purpose:

Open the simulator

Learn more

Part of the guide Message queues vs event streams.

Related failure modes