Try
↑ ↓ move↵ openesc close

Interview prep / Partitioned logs

Senior · Partitioned logs · System design interview question

One customer generates a third of your traffic and you key by customer. How do you keep the partition from falling behind?

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

A strong answer

A key maps to one partition and a partition has one reader in the group, so neither more partitions nor more consumers helps a single key. The options all trade order for balance.

Add a salt to the key for the big customer, such as a small random suffix, so its traffic spreads over several partitions. Order then holds only within each suffix. Or split by a finer key, like the customer plus the entity inside it. Or make that consumer faster by batching, or by moving heavy work to a separate pool.

Ask what ordering the customer really needs. It is often per entity and not per customer. And measure first rather than assume the cause.

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