Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What exactly is an offset?

Kafka · Extra High-Value

What exactly is an offset?

Easykafka-31
offsetpartitionconsumerbasics

Question

In one crisp answer: what is a Kafka offset, and what is it not?

Solution

An offset is a per-partition, monotonically increasing identifier for a record in that partition's log.

topic orders / partition 2
offset 100 → record A
offset 101 → record B
offset 102 → record C

What it is

  • A bookmark position inside one partition
  • Assigned by the broker when the record is appended
  • Used by consumers to know what to read next
  • Committed by consumer groups to mark progress

What it is not

  • Not global across a topic (partition 0 offset 5 ≠ partition 1 offset 5 as the "same" event)
  • Not a timestamp (though records also have timestamps)
  • Not a primary key of your business event (your event should have its own id)

Related ideas

  • Log end offset / high watermark: newest offsets available to consumers
  • Committed offset: last progress saved for a group
  • Consumer position: where the consumer is currently reading

Interview tip: "Offset = index in a partition log. Always say which partition."

PreviousNext