Skip to content
Kafka Is Fun

Lesson 3 of 6

Topics, Partitions & Offsets

1 min read

Overview

A topic is a named category of events that producers write to and consumers read from. Topics are split into partitions: each partition is an ordered log that events are appended to, and events with the same key are written to the same partition. Each record in a partition has an offset, a single integer giving its position. Kafka guarantees that a consumer of a topic-partition reads that partition's events in exactly the order they were written; the guarantee is stated per partition.

Analogy

Key configuration

Settings (broker default or topic-level)properties
num.partitions (broker, default 1) — default partition count for newly created topics
retention.ms (topic, default 604800000 = 7 days) — how long events are kept
retention.bytes (topic, default -1 = no limit) — size cap, enforced per partition

Production tip

Check yourself

Message A is written to partition 0 and message B to partition 1 of the same topic. What does Kafka guarantee about their order?

Sources

Checked against Kafka 4.2 documentation on Oct 2026. Draft: not yet reviewed by a Kafka specialist. Releases move on, so confirm against the current documentation before you act on a number.

Try it in the simulator

Guided scenarios for this module — the simulator opens with the exercise already running.

Prefer a picture? Open the live cluster in 3D and watch records move between producer, brokers and consumers.