---
title: "The consumption engine: leases and cursors"
description: "Pops, acks and leases are served from the leader's memory, outside the planner, and the changed cursors go into the log as one small checkpoint at least every 5 ms."
---

> Queen MQ documentation, for AI agents
> Complete self-contained summary of Queen MQ: https://queenmq.com/llms-brief.txt
> Fetch that first when the question is about the product rather than about this page.
> Index of all pages: https://queenmq.com/llms.txt

# The consumption engine: leases and cursors

Pops, acks and leases do not go through the planner. The leader keeps each consumer group's positions and leases in memory, and gives out the oldest ready partition first.

The positions that changed go into the log as one small checkpoint, at once when an answer is waiting and at least every 5 ms. A pop gets its answer only after that checkpoint is committed. A pop that finds nothing waits, and is woken when a new message arrives in its partition.

**Figure.** Pops, acks and leases do not go through the planner. The consumption engine on the leader holds each group's positions and leases in memory and gives out the oldest ready partition first. The positions that changed go into the log as one small checkpoint, at once when an answer is waiting and at least every 5 milliseconds; a pop is answered only once that checkpoint is committed. A pop that finds nothing waits and is woken when a message arrives in its partition. A new leader waits about half a second before it serves pops.

Pops, acks and leases, served from the leader's memory.

We moved consumption out of the planner because acks were waiting behind pushes: at 300,000 messages a second, an ack took more than 500 ms. Now many acks travel in one checkpoint.

A partition idle for 10 minutes leaves memory, and is loaded again with its next message. A new leader waits about half a second before it serves pops, so the same messages are never given out twice.

Source: https://queenmq.com/architecture/consumption-engine/index.mdx
