Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A Kafka topic is a named feed, partitions are its ordered logs, and each record’s offset is its position within one partition. Kafka guarantees order inside a partition—not one global order across a multi-partition topic. Consumers read records without deleting them; retention and a consumer group’s stored progress are separate concerns.

How topics, partitions, and offsets fit together

Think of a topic as a subject with several numbered notebooks. The topic names the feed; each notebook represents a partition, and records are appended to that partition’s log. An offset labels a record’s position in that particular log. This model follows Apache Kafka’s introduction to Kafka.

  • Topic: the named category or feed to which producers publish records.
  • Partition: an ordered log that stores a subset of the topic’s records.
  • Offset: a position within one partition’s log, not a topic-wide record number.

Because offsets belong to individual partitions, the same numeric offset can identify positions in different partitions. To identify a record’s position unambiguously, consider both its partition and offset.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What ordering Kafka guarantees

Kafka preserves record order within each partition. Its documentation states: “Kafka only provides a total order over records within a partition, not between different partitions in a topic.” See Apache Kafka’s ordering and consumer groups documentation.

For example, imagine an orders topic with partitions 0 and 1. Each partition has its own offset sequence. A record at offset 12 in partition 0 and one at offset 8 in partition 1 do not have a Kafka-defined before-and-after order relative to each other. Each partition is ordered on its own; the topic as a whole is not one combined sequence.

If an application requires a single topic-wide order, using one partition is the straightforward trade-off: it removes the cross-partition ordering ambiguity, but also limits partition-level parallelism for consumer groups.

How consumer groups use partitions

A consumer group lets multiple consumer instances share a topic’s partitions. Kafka assigns partitions among the instances in that group; each assigned partition is read in order. With the two-partition orders example, a group could assign one partition to each of two consumers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Partitions set the ceiling on partition-level work slots in a group: adding more consumer instances than the group has partitions cannot create additional partitions to assign. A separate consumer group can read the same topic independently, with its own progress state. Kafka describes this partition and group model in its introduction documentation.

Why reading a record does not delete it

Reading advances a consumer’s position; it does not remove the record from Kafka. Retention settings govern how long records remain available. If a record is still retained, a consumer can move its position back and read it again. The consumer’s progress and the log’s continued availability are distinct, as described in the Kafka introduction.

Record offsets and committed consumer progress

Two different ideas are often called an offset:

  • Record offset: the record’s position within a specific partition.
  • Committed consumer offset: a consumer group’s stored progress position for reading. It is progress state, not the record itself.

A committed position does not, by itself, prove that an application definitely finished processing every record before it. That depends on how the application coordinates processing with committing progress. Avoid treating the stored offset as a universal guarantee about application-level completion.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Inspecting a group’s positions and lag

Kafka’s operations tooling can report group offsets, log-end positions, and lag, and it supports resetting offsets. The exact commands and flags depend on the Kafka version, so use the reference for the version you operate. For Kafka 3.8, see Basic Kafka Operations, which documents kafka-consumer-groups.sh --describe --group ... for describing a group and covers offset resets.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.