Skip to content
BENIBIX Learn

Kafka Offset

Also known as Offset, Consumer Offset, Committed Offset

The place number of an event in a partition. Readers save it like a bookmark.

Think of it like

It is like a bookmark. It shows the last page you read, so you can pick up there next time.

Example

A billing service crashes after reading offset 5,120. When it restarts, it carries on at 5,121, and no bill is missed.

Why it matters

Offsets are how Kafka readers survive crashes. They also let you replay data by moving the bookmark back.

Definition

A Kafka offset is the position number of an event inside a partition. The first event is 0, the next is 1, and so on. A consumer saves, or commits, the offset it has reached. If it stops and starts again, it carries on from that saved offset. You can also reset an offset to read old events again.

Common mistake

Committing the offset before the work is done. If the reader then crashes, those events are skipped for good.

Key takeaways

  1. 1
    A place number. Counts up inside each partition.
  2. 2
    Committed by readers. Saved so a restart resumes there.
  3. 3
    Can be reset. Move it back to replay.