Scenario 00.1.4 · Offsets are per-partition
Kafka offsets are per partition, not global
Offset = position within a partition, not a global id. Ordering holds inside a partition, never across them.
Run this scenario in the playgroundEmpty topic. t+0.000s
Two partitions will receive records. Watch the offsets.
Open at this step: step 1, Empty topicOffset 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 partitionsOffset 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 idWhat 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
- Empty topic t+0.000s Two partitions will receive records. Watch the offsets. Open at this step: step 1, Empty topic
- 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
- 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
More in Anatomy
- Kafka topics, partitions and offsets explained
- Kafka write path: one record from producer to consumer
- Kafka message keys: how a key picks the partition
- Kafka replication factor, leader and follower replicas
- Kafka high watermark vs log end offset (LEO)
- Why Kafka consumers cannot read past the high watermark
- Kafka log start offset: why the earliest offset is not 0