Monedula

Scenario 00.1.4 · Offsets are per-partition

Kafka offsets are per partition, not global

Anatomy · Beginner · about 2 min · Apache Kafka 4.3

Offset = position within a partition, not a global id. Ordering holds inside a partition, never across them.

Run this scenario in the playground

Offset is per-partition, not a global id. t+1.250s

Both partitions now hold offsets 0 and 1. 'Offset 1' is ambiguous on its own - it means a different record in each partition. Ordering is guaranteed only within a partition, never across them.

Open at this step: step 3, Offset is per-partition, not a global id

What you start with

An offset is a position within a single partition, not a global sequence number across the topic. With records spread over several partitions, watch each partition number its own records from 0 independently.

Step by step

  1. Empty topic t+0.000s Two partitions will receive records. Watch the offsets. Open at this step: step 1, Empty topic
  2. Offset 0 in two partitions t+0.850s Keys C and F landed in two different partitions, each at offset 0. Two records, same offset number - they are different records in different partitions. Open at this step: step 2, Offset 0 in two partitions
  3. Offset is per-partition, not a global id t+1.250s Both partitions now hold offsets 0 and 1. 'Offset 1' is ambiguous on its own - it means a different record in each partition. Ordering is guaranteed only within a partition, never across them. Open at this step: step 3, Offset is per-partition, not a global id

The takeaway

Offsets are only comparable within the same partition; there is no global order across partitions, so ordering guarantees stop at the partition boundary.

Embed this scenario

Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.

<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=00.1.4" title="Kafka Simulator: Offsets are per-partition" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/offsets-per-partition/">Kafka offsets are per partition, not global</a></p>

Further reading

Apache Kafka documentation

More in Anatomy

All scenarios