tutorials29 min read
A Queue Doesn't Lose Work, It Makes It Wait: Consumer Lag, Partitions and a Worker That Can't Keep Up
Orders go through fine, but confirmation emails arrive late: first by a few minutes, then by close to an hour. The CPU is idle, the broker is idle, the database is idle. The culprit is a worker that handles messages one at a time and a topic with a single partition. We walk through reading consumer lag, calculating a consumer's capacity as concurrency ÷ latency, and processing concurrently while committing offsets without losing messages.