Scrivio Interview library
ConceptFoundations7 min read · updated 13 November 2026

A sharded system reports average CPU of 35 percent across 32 shards, yet users see timeouts. Skew means that data or load is not spread evenly across partitions, and averages hide it.

Which kinds of skew exist, why do averages hide them, and which metrics would you put on a dashboard to see skew early?

There are three kinds of skew: data skew, where some partitions hold far more data; load skew, where some keys receive far more requests; and temporal skew, where load follows time so all current writes hit one partition. Averages hide skew because one shard at 100 percent and 31 at 33 percent still average about 35 percent. So a dashboard shows the maximum and the max-to-mean ratio per resource, a per-partition heat map and the top keys by requests and size, and alerts on the ratio and its trend.

Why this question is asked

Sharding promises that load is spread across many machines, and the averages usually confirm it. The trouble is that a user's request does not hit the average shard; it hits a specific one, and if that one is saturated, the user times out no matter how idle the rest are. Interviewers ask this concept question because recognising skew, and building monitoring that shows it, is a basic skill for anyone running a partitioned system. In this answer, we will see how an average of 35 percent can hide a saturated shard, go through the three kinds of skew with examples, and design a dashboard and alerts that reveal skew early.

1A Quick Recap: How an Average Hides a Hot Shard

A sharded system splits data and traffic across partitions, here 32 shards, using a key such as a customer id. If the key spreads load evenly, every shard does about one thirty-second of the work. Skew means the spread is uneven: some partitions get much more than their share.

Here is how the dashboard can lie. Suppose one shard is at 100 percent CPU and the other 31 are at 33 percent. The average is (100 + 31 x 33) / 32 = 1,123 / 32, about 35 percent. The fleet looks comfortable, yet every request routed to the hot shard waits in a queue and many time out. Since each customer's requests always go to the same shard, the same customers suffer again and again, while the overall error rate still looks small.

Java
double[] cpu = new double[32];
Arrays.fill(cpu, 33.0);
cpu[7] = 100.0; // one hot shard
double mean = Arrays.stream(cpu).average().orElse(0); // 35.09
double max = Arrays.stream(cpu).max().orElse(0); // 100.0
System.out.printf("mean=%.1f max=%.1f ratio=%.2f%n", mean, max, max / mean);
// mean=35.1 max=100.0 ratio=2.85

2Data Skew: Some Partitions Hold Far More Data

Data skew means some partitions are much larger than others. A common cause is a large tenant: in a B2B system sharded by tenant, one enterprise customer can hold more data than a thousand small ones. Another is an unbounded partition, for example a Cassandra partition keyed by device id that keeps every reading forever, growing without limit.

Large partitions hurt in ways that are slower than CPU spikes but just as real. Storage on that shard fills first. Maintenance takes longer: compaction, vacuum, backups and index rebuilds scale with size. And moving or rebalancing that partition is slow because there is so much to copy. Data skew often turns into load skew too, because larger partitions usually receive more queries.

3Load Skew: Some Keys Receive Far More Requests

Load skew means some keys receive far more traffic than others, even if their data is small. The classic examples are a celebrity user whose profile and posts millions of people read, a product on a flash sale, or a popular configuration key that every request reads. Hashing spreads keys evenly, but it cannot split a single key: all requests for one key go to one partition. So that partition's node saturates while the others idle.

Load skew is often bursty and tied to real-world events, which makes it hard to plan for. A key can be quiet for months and then receive a hundred times its normal traffic in minutes.

4Temporal Skew: Load That Follows the Clock

Temporal skew happens when the key contains time. If a table is partitioned by date, or a key starts with the current hour, every new write goes to the partition for now. All the write load lands on one partition, and when the hour or day changes, the hot spot simply moves to the next partition. It never disappears, because there is always exactly one current partition. This is common with time-series data, logs and events, and with range-partitioned stores where the key is a timestamp or an increasing id. The fix is in the key design: put a well-spread component, such as a device id or a hash bucket, before the time component, so concurrent writes spread across partitions.

The three kinds of skew
KindExampleSymptomTypical fix
Data skewone huge tenant, unbounded partitionone shard's disk and maintenancesplit the tenant, bound partitions
Load skewcelebrity user, flash-sale productone node's CPU or IOPS at 100 percentcache, replicate reads, split the key
Temporal skewkey starts with today's dateall writes on the current partitionspread prefix before the time

5A Dashboard That Shows Skew Early

The guiding rule is never to show an average alone. For each resource, CPU, disk used, read and write IOPS, request rate and p99 latency, the dashboard shows the maximum across shards next to the mean, and the max-to-mean ratio as its own line. A ratio near 1.0 means an even spread; 2.85, as in our example, means one shard does almost three times the average work.

Next, a heat map with one row per shard (or per partition) and time along the x axis, coloured by load. Skew shows up as a bright horizontal stripe for a hot shard, or a bright diagonal moving across partitions for temporal skew. Third, top-N tables: the top 20 keys by request rate and the top 20 partitions by size, which point directly at the culprit. Many systems can sample these; Cassandra's toppartitions and Redis's hotkeys option of redis-cli are examples, and the routing layer can count requests per key or bucket. Finally, p99 latency per shard rather than for the fleet, since a fleet-wide p99 can also hide one slow shard.

Panels on a skew dashboard
PanelWhat it showsWhy
Max, mean and max/mean per resourcee.g. CPU 100 / 35 / 2.85averages hide the hot shard
Heat map: shards by timestripes and moving diagonalsload and temporal skew at a glance
Top keys by requestscelebrity or flash-sale keysnames the hot key
Top partitions by sizehuge tenants, unbounded partitionsnames the data skew
p99 latency per shardthe shard users actually feelfleet p99 can hide it too

6Alerting on the Ratio and Its Trend

Alerts on absolute thresholds, such as CPU above 90 percent on any shard, catch a problem only when it is already hurting. To see skew early, we also alert on the max-to-mean ratio, for example above 1.5 for 30 minutes, and on its trend, for example the ratio rising steadily over a week, or a single key's share of a shard's requests growing day by day. A key whose traffic doubles every few days will saturate its shard soon; noticing the trend gives us time to cache it, split it or move it before users see timeouts.

7Follow-up questions

Why can't a hash-based partitioning scheme prevent load skew?

Hashing spreads different keys evenly, but all requests for the same key must go to the same partition, because that is where the key's data lives. A single very popular key is therefore always on one node. Fixing it needs something beyond hashing: caching the key's value, replicating it for reads, or splitting it into several sub-keys, for example by appending a small random suffix to spread writes and reading all suffixes.

Is max-to-mean the only useful ratio?

It is the simplest. Some teams also track the coefficient of variation (standard deviation divided by mean) or the p99 shard versus the median shard. Max-to-mean is the most direct because the hottest shard is the one that fails first.

How does skew affect capacity planning?

Capacity has to be planned for the hottest shard, not the average one. If the max-to-mean ratio is 2, the fleet effectively has half its apparent capacity, and adding shards will not help unless the hot data or keys can actually be spread.

8Conclusion

In this answer, we saw that one shard at 100 percent and 31 at 33 percent average about 35 percent, so averages hide the shard that users actually hit. Skew comes in three kinds: data skew from large tenants or unbounded partitions, load skew from hot keys such as celebrities or flash-sale products, and temporal skew from keys that contain time, where the hot spot moves but never disappears. A useful dashboard shows the maximum and the max-to-mean ratio per resource, a per-shard heat map, the top keys by requests and size and per-shard p99 latency, with alerts on the ratio and its trend.

What to say in the interviewAbout 90 seconds aloud

Open with

Skew means data or load is not spread evenly over the partitions, and averages hide it because users do not hit the average shard. One shard at 100 percent CPU and 31 at 33 percent average out to about 35 percent, which looks healthy while every request routed to that shard times out.

Then, if they want more

I think of three kinds. Data skew: some partitions hold far more data, like a huge tenant or an unbounded partition, so their storage, compaction, backups and moves are slow. Load skew: some keys get far more requests, a celebrity user or a flash-sale product, and hashing cannot split a single key, so one node saturates while others idle.

Temporal skew: the key contains time, like today's date, so all current writes hit one partition; the hot spot moves every day but never goes away. On the dashboard I would never show an average alone.

I show the max next to the mean and the max-to-mean ratio for CPU, disk, IOPS, requests and latency, a heat map of load per shard over time, which shows hot stripes and moving diagonals, top keys by request rate and top partitions by size, and p99 latency per shard.

And I alert on the ratio and its trend, not only on absolute thresholds, so a key that is becoming hot is noticed before its shard saturates.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Which kinds of skew exist, why do averages hide them, and which metrics would you put on...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/aba1bc0e0c/