CodePark/ questions / Kafka: topics, partitions & brokers
START PRACTICINGPRACTICE
Backend question · Message queues & streaming › Kafka: topics, partitions & brokers

What ordering does Kafka guarantee for a topic with 6 partitions?

Records are ordered within each partition, with no ordering between partitions

Kafka orders records within each partition only. Each partition is an ordered log, and consumers read it in offset order. But consumers read different partitions independently, so there is no total order across the whole topic.

This is why records that must stay in order use the same key. The same key always goes to the same partition.


"Records are delivered in the order they were produced across the whole topic" is wrong, because the 6 partitions are read independently.


"Records are ordered by timestamp across the topic" is wrong too. Timestamps are only metadata. They do not control delivery order.