AlgoViz

Diagnosing skew and hot partitions

hard 7 min

Partitioning assigns data and its traffic to owners according to a key.

Video lesson · Chapter 1 of 4

One tenant overloads a shard

0:00 / 2:11

Theory

Read or listen first. About 2 min.

What it is

Partitioning assigns data and its traffic to owners according to a key. Hashing spreads distinct keys, while ranges preserve locality for scans. Neither automatically divides the traffic of one frequently accessed value. Resharding trades migration work and temporary routing complexity for a new distribution.

Why it exists

Total cluster load looks modest while one tenant times out. Compare per-partition rates, key frequency and operation cost. An even byte distribution can coexist with a very uneven request distribution. Splitting a hot tenant across buckets can reduce concentrated writes, but tenant-wide reads must then combine results and correctness boundaries may change.

If load is spread over many keys on one shard, a range split or capacity rebalance may help without redesigning a single hot key.

One tenant overloads a shard

Request router → Shard key (derive key). Shard key → Partition owner (route operation)
Request router → Shard key (derive key). Shard key → Partition owner (route operation)

Inside this chapter

Horizontal vs. Vertical partitioning
Horizontal partitioning divides rows among owners. Vertical partitioning divides attributes or responsibilities. Choose according to access locality and the cost of reconstructing a complete result.
Key-Range partitioning
Range partitions make ordered scans easy to route. A monotonically increasing key can concentrate new writes into the newest range.
Hash partitioning
Hash partitioning distributes distinct keys across owners. Range scans may then require multiple owners, and one frequently accessed key remains concentrated.
The problem of Hot Keys/Hot Partitions
A hot partition may contain many busy keys or one dominant value. Per-key rates distinguish repartitioning data from changing how a single logical key distributes work.
Cross-Shard Queries and Scatter-Gather
Scatter-gather fans a request out and combines replies. Tail completion can be set by the slowest shard. Bound fan-out and define partial-result behavior.
Resharding Strategies
Resharding moves data while routing and writes continue. A safe migration coordinates ownership, catches up changes and verifies completeness before switching readers and deleting old copies.
Consistent Hashing for Databases
A consistent-hash ring changes ownership for part of the keyspace on membership changes. Virtual nodes improve balance statistically. Replication and migration bandwidth still require explicit planning.

How it works

Step through the idea, or press Play.

Step 1 of 4

Choose a partition key. The router derives an owner from each write’s key.

Understand it

Worked incident

One tenant overloads a shard

ObservationBusiest partition load (requests/s)Interpretation
Baseline200The busiest partition has spare capacity.
Incident850A single tenant’s writes concentrate on its owner.
After intervention310Bucket that tenant’s work using a compatible key and quantify the extra read fan-out.
Illustrative measurements from the same workload at three checkpoints.

Choose the next investigation

If load is spread over many keys on one shard, a range split or capacity rebalance may help without redesigning a single hot key.

Summary

The whole topic in one minute.

All operations for the same hash key still map to one owner unless the data or access model changes.

If load is spread over many keys on one shard, a range split or capacity rebalance may help without redesigning a single hot key.

Sources