Scenario 00.1.1 · Topic, partition, offset
Kafka topics, partitions and offsets explained
A topic is split into partitions; each partition is an ordered log; an offset is a position within a partition.
Run this scenario in the playgroundTopic ready · 3 empty partitions. t+0.000s
A topic is not one queue - 'orders' is split into 3 partitions. Each partition is an independent, append-only log. All three start empty at offset 0.
Open at this step: step 1, Topic ready · 3 empty partitionsFirst records land · one per partition. t+1.050s
Three records (keys A, C, F) each landed in a different partition, every one at offset 0. Where a record lands is decided by its key (see 00.1.3).
Open at this step: step 2, First records land · one per partitionEach partition is an ordered log · offsets count up. t+1.700s
Six records total, two per partition. An offset is a record's position within its partition: each partition now holds offsets 0 and 1. Offsets are assigned per partition, always starting at 0.
Open at this step: step 3, Each partition is an ordered log · offsets count upWhat you start with
A topic isn't a single queue - Kafka splits it into independent partitions, each an ordered, append-only log. Here a producer writes six keyed records to a 3-partition topic; watch each record land in one partition and take the next offset (its position within that log).
Step by step
- Topic ready · 3 empty partitions t+0.000s A topic is not one queue - 'orders' is split into 3 partitions. Each partition is an independent, append-only log. All three start empty at offset 0. Open at this step: step 1, Topic ready · 3 empty partitions
- First records land · one per partition t+1.050s Three records (keys A, C, F) each landed in a different partition, every one at offset 0. Where a record lands is decided by its key (see 00.1.3). Open at this step: step 2, First records land · one per partition
- Each partition is an ordered log · offsets count up t+1.700s Six records total, two per partition. An offset is a record's position within its partition: each partition now holds offsets 0 and 1. Offsets are assigned per partition, always starting at 0. Open at this step: step 3, Each partition is an ordered log · offsets count up
The takeaway
A record is addressed by topic + partition + offset: ordering is guaranteed within a partition, and an offset simply counts the appends to that one log.
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.1" title="Kafka Simulator: Topic, partition, offset" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/topic-partition-offset/">Kafka topics, partitions and offsets explained</a></p> Further reading
More in Anatomy
- Kafka write path: one record from producer to consumer
- Kafka message keys: how a key picks the partition
- Kafka offsets are per partition, not global
- 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