Skip to content
Kafka Is FunProgress

BeginnerCore Concepts

How does Kafka guarantee message ordering?

Reference answer

Kafka guarantees strict ordering only within a single partition. Messages produced with the same key always go to the same partition, ensuring order for that key. Across partitions, there is no ordering guarantee — messages in partition 0 and partition 1 may be read in any interleaved order by consumers. To guarantee total ordering across an entire topic, use a single partition, but this eliminates parallelism. In practice, per-key ordering within partitions is sufficient for most use cases.

Expected key concepts: within partition, same key, same partition, per-key ordering, single partition, total ordering, no cross-partition guarantee