Interview prompt
Problem context
Skills being evaluated
Use the sequence below to surface constraints, choose boundaries, test failure behavior, and defend trade-offs. Concrete numbers are interview assumptions, not claims about a real production system.
Clarify the decision
- Identify required ordering and aggregation scope, how quickly heat shifts, and whether one series can be split safely by time or write stripe. Define the cost of tenant scans versus point writes.
Establish scale assumptions
- Model p99 series write rate, not only billions of keys, and track bytes, compaction, and query fan-out per partition. Assume a hot key can exceed one node and requires an explicit split strategy.
Functional and non-functional requirements
- Absorb sudden skew, preserve per-series semantics, move ownership without lost writes, and bound query amplification. Placement changes must not oscillate with every brief spike.
High-level architecture
- Use many virtual partitions with a consistent placement directory, heat telemetry, and a rate-limited rebalancer. Promote extreme keys to salted write stripes or time buckets, then merge reads through a per-series manifest.
Data model and flow
- Writers resolve a cached placement epoch and include it with each batch. Storage rejects stale epochs; the mover transfers immutable segments and tails new writes before publishing the next manifest.
Consistency and transaction boundaries
- Ordering is per stripe or time bucket, so a sequencer or merge rule restores the promised per-series view. Tenant-wide queries accept scatter-gather with limits or consume pre-aggregated tenant indexes.
Failure modes and recovery
- Fencing prevents old placements from accepting writes after a move. Rebalance controllers use hysteresis, move budgets, and rollback states; a failed split leaves the original owner authoritative.
Security and privacy
- Placement and manifests are tenant-scoped, and hot-key metrics avoid exposing customer identifiers. Movement preserves encryption and locality policy, including deletion across obsolete copies.
Observability and SLOs
- Measure skew ratios, partition saturation, placement-cache misses, stale-epoch rejects, move convergence, read fan-out, and rebalancer churn. Alert on heat that no legal split can absorb.
Capacity and cost
- Virtual partitions and adaptive stripes improve utilization but add metadata and read amplification. Keep cold data compact, reserve burst headroom, and move only when predicted incident cost exceeds transfer and fragmentation cost.
Alternatives and trade-offs
- Pure hashing is simple but cannot split one key; salting scales writes but scatters reads and ordering. Use adaptive salting only for exceptional keys and store a manifest that hides layout from clients.
Evolution and migration
- Introduce placement epochs and virtual partitions before dynamic splitting. Shadow heat recommendations, manually approve early moves, then automate with conservative hysteresis and post-move verification.
What Staff and Principal candidates should emphasize
- Principal candidates acknowledge that partition count does not solve a single hot key. They design fencing, adaptive split forms, query recomposition, movement economics, and stability against rebalancer oscillation.
Decision trade-offs
Base partitioning
Option A
Hash by series identifier
Option B
Range by tenant and time
Recommendation:Use hashed virtual partitions for broad balance, then maintain explicit secondary structures for tenant scans and hot-series exceptions.
Hot-key response
Option A
Move the whole key to a larger node
Option B
Stripe the key across partitions
Recommendation:Move for moderate heat; stripe only when one node cannot sustain the key and the read/ordering recomposition cost is acceptable.
Follow-up interview questions
- 01How do you prevent a rebalancer from chasing short-lived spikes?
- 02How are ordered reads reconstructed from salted write stripes?
- 03What if data residency prevents moving a hot tenant to the least loaded region?
- 04How does a client recover from a stale placement cache?
Common weak answers and mistakes
- 01Assuming consistent hashing automatically solves a single hot key.
- 02Salting every key and ignoring query fan-out and ordering reconstruction.
- 03Moving state without an epoch that fences cached stale writers.
- 04Automating moves without hysteresis, budgets, or economic thresholds.
Interviewer evaluation rubric
Adds partitions or consistent hashing but cannot address a key that exceeds one partition’s capacity.
Uses virtual partitions, heat measurement, controlled movement, and a basic exceptional hot-key strategy.
Adds placement epochs, adaptive stripes, manifests, query recomposition, hysteresis, residency, and move verification.
Balances dynamic placement against query semantics and movement economics while keeping the topology invisible to most clients.