Try
↑ ↓ move↵ openesc close

Interview prep / Partitioned logs

Mid · Partitioned logs · System design interview question

What ordering does a partitioned log guarantee, and how do you get ordering across keys if you need it?

Sketch your own answer first, then compare it with the one below.

A strong answer

Messages in the same partition are delivered in the order they were appended. Because the key picks the partition, messages with the same key are ordered. There is no guarantee between partitions.

For a global order you can use a single partition, which caps throughput, or you can attach a sequence number or timestamp and reorder downstream, accepting buffering and some delay. Often the real requirement is order per entity, and the key already gives it.

Separate what needs order from what does not. Producer retries can also reorder messages unless the producer limits sends in flight.

Sources

Learn it by running it

The partitioned logs lesson explains the mechanism behind this question, and its lab lets you change the parameters and watch the effect.

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms