Blog

Hot Partitions and Partial Failures: Investigating Incidents in Sharded Systems

A hot partition hides behind healthy averages. How to investigate skewed keys, rebalancing and partial failures in a sharded system, one slice at a time.

  • hot partition
  • sharding
  • partitioning
  • partial failure
  • root cause analysis

In a sharded system, “the database looks fine” is almost always true on average and false somewhere.

Partitioning, also called sharding, splits data across machines so that no single machine has to hold or serve all of it. It is how systems scale past one node, and it changes the shape of incidents in a way that dashboards are bad at showing. A cluster of twenty nodes running at 30% CPU on average can contain one node at 98%. A consumer group can be a few seconds behind overall while one of its partitions is three hours behind. A search query can return results from nine shards out of ten and look perfectly normal. The problem is local and the default view is global, so the first hour of the incident is often spent staring at healthy averages.

Martin Kleppmann’s Designing Data-Intensive Applications has a chapter on partitioning that explains why this happens: how keys are assigned to partitions, why some partitions get far more load than others, how secondary indexes and rebalancing behave, and why partial failure is the normal state of a distributed system. This article uses those ideas to investigate a hot partition and its relatives: how they surface, which evidence separates the rival explanations, and how to write a finding that prevents the next one.

Table of Contents

Why partitioning changes the shape of an incident

In a partitioned system each record belongs to exactly one partition, chosen by its key. Queries that touch one key go to one partition; queries that need many keys may touch many partitions. Kleppmann’s framing is that the goal is to spread data and load evenly, and that when the spread is uneven the system is skewed. A partition with disproportionately high load is a hot spot.

Three consequences matter for an investigation:

  1. Problems are local. Load, latency, errors and lag can all concentrate in one partition while the rest of the system is healthy. Aggregate metrics dilute a local problem by the number of partitions.
  2. Symptoms follow keys, not users at random. If the hot partition holds certain tenants, regions, products or dates, every symptom will be about those. “Only some customers are affected” is the classic first clue.
  3. Partial failure is normal. With enough partitions, something is always slow, moving or recovering. Kleppmann’s chapter on the trouble with distributed systems makes the general point: in a distributed system, some parts can be broken while others work, and the failures are often non-deterministic. The question during an incident is never “is anything unhealthy?” but “is the unhealthy part the one that explains this symptom?”

The practical rule follows: split every symptom by partition before you form a hypothesis. By shard, by key range, by tenant, by region, by queue partition. If the problem is uniform across partitions, it is probably not a partitioning problem. If it is concentrated, you have already narrowed the search enormously.

How keys are assigned, and how each scheme goes wrong

The book describes two main ways to map keys to partitions, and each has a characteristic failure.

SchemeHow it worksStrengthHot-spot patternIncident signature
Key rangeEach partition holds a contiguous range of keysEfficient range scansSequential keys, such as timestamps or increasing IDs, send all new writes to the last rangeOne partition takes all writes; it changes as time moves on
Hash of keyA hash of the key decides the partitionEven spread for many keysA single very popular key still lands on one partitionOne partition hot for a specific entity; others idle
Compound keyHash on the first part, range on the restSpread plus range scans within an entityA large or busy first-part value, such as one big tenantOne tenant’s partition grows or heats while others stay small

The key-range case is worth recognising on sight. Kleppmann’s example is sensor data keyed by timestamp: every write for today goes to today’s partition, which is overloaded while the rest sit idle. The fix is to put something before the timestamp in the key, such as a sensor ID, so writes spread out, at the cost of range queries that must now ask every partition. Any system keyed by an increasing value has the same shape: auto-increment IDs, time-ordered IDs, monotonic sequence numbers.

Hash partitioning fixes that but loses efficient range queries. It also has a limit that surprises people during incidents: hashing spreads different keys evenly; it cannot spread one key.

Hot keys: skew that hashing cannot fix

If one key receives a large share of all requests, every one of those requests goes to the partition that owns the key, however good the hash function is. Kleppmann’s example is a celebrity on a social network whose every action fans out to millions of followers. In business systems the celebrities are a very large customer, a popular product during a sale, a default value that many records share, or a placeholder key such as unknown or 0 that a bug assigns to everything.

AWS’s guidance on designing partition keys to distribute your workload describes the effect in DynamoDB’s terms: a key design that concentrates requests creates “hot” partitions, which can lead to throttling while the table’s total capacity is far from used. The same pattern exists in every partitioned store, whether it calls the symptom throttling, timeouts or lag.

The standard mitigation is to split a known hot key, for example by appending a small random suffix so its writes spread across several partitions. The book is clear about the cost: reads for that key must now query every suffix and combine the results, and the system needs to remember which keys are split. It is a targeted fix for known hot keys, not a general design.

Finding the hot key

The hot key is rarely visible in aggregate metrics. You need per-key counts from the window, and logs are often the fastest source. If request logs carry the partition key, group by it. In Google Cloud Logging, a filter that narrows to the slow requests on one shard is a good start, and the Google Cloud Logging debugging queries article shows how to compare it with a healthy window:

resource.type="k8s_container"
labels."k8s-pod/app"="orders-api"
jsonPayload.shard="7"
jsonPayload.latency_ms>1000
timestamp>="2026-11-06T09:00:00Z"
timestamp<"2026-11-06T10:00:00Z"

If the store itself records the key, a read-only query by key over the incident window is often decisive. A sketch, assuming a request or audit table with the partition key in it:

-- Top partition keys by volume in the incident window, against the previous week.
-- Read-only. Run on a replica or a reporting copy if the primary is under pressure.
SELECT tenant_id,
       SUM(CASE WHEN created_at >= '2026-11-06 09:00' AND created_at < '2026-11-06 10:00'
                THEN 1 ELSE 0 END) AS incident_hour,
       SUM(CASE WHEN created_at >= '2026-10-30 09:00' AND created_at < '2026-10-30 10:00'
                THEN 1 ELSE 0 END) AS same_hour_last_week
FROM   api_requests
WHERE  created_at >= '2026-10-30 09:00'
GROUP  BY tenant_id
ORDER  BY incident_hour DESC
LIMIT  20;

What you are looking for is a key whose share jumped, not just a key that is large. The biggest tenant is usually the biggest tenant every day. A tenant that went from 2% of requests to 40% is the finding.

Skewed keys in batch and stream jobs

Hot keys hurt data processing as much as they hurt databases. Batch and stream frameworks group records by key for joins and aggregations, and each key’s records go to one task. Kleppmann describes this as skew in joins: one task gets far more records than the rest and becomes a straggler, so the whole job waits for it. The symptom is a job that reaches 99% of tasks in ten minutes and then spends an hour on the last one, or a stream processor where one partition’s lag grows while the others are current.

The investigation question is the same: which key landed on the slow task, and why did it grow? A new tenant, a null or default value assigned to many records, or an upstream bug that stamps everything with one key are all common. The stream vs batch processing article covers what else goes wrong when the two kinds of job disagree.

Secondary indexes and scatter-gather

Partitioning by primary key is straightforward. Secondary indexes are where it gets interesting, and Kleppmann describes two approaches with opposite failure modes.

Index typeHow it is partitionedReadsWritesIncident shape
Local (by document)Each partition indexes only its own recordsMust ask every partition and merge (scatter-gather)Update one partitionOne slow partition slows every query; partial results if a partition does not answer
Global (by term)The index itself is partitioned by the indexed valueAsk only the partition that holds the termTouch several partitions, often asynchronouslyIndex lags behind the data; a record exists but cannot be found by the index

The global index case belongs with the stale-read incidents in stale reads and consistency models: a record written a second ago does not appear in a query by its secondary attribute because the index update has not propagated. The local index case belongs here, because its signature is latency and partial results.

Tail latency amplification

When a query fans out to every partition, its latency is the latency of the slowest partition it waited for. Jeffrey Dean and Luiz André Barroso’s paper The Tail at Scale works through the arithmetic with an example: if each server responds slowly to one request in a hundred, a user request that must wait for a hundred servers in parallel will be slow about 63% of the time, since 1 − 0.99¹⁰⁰ ≈ 0.63. A rare problem on each partition becomes a common problem for every fan-out query.

For an investigation, this has two implications. First, a single slow partition can make a large fraction of user requests slow, which means a small, local problem produces a broad, global symptom. Second, the slow partition may not be slow in its own metrics by much. A p99 that is only somewhat worse on one node becomes the p50 of every fan-out query. When fan-out queries are slow, look at per-partition response times for those queries, not at node averages.

Rebalancing: the incident you schedule yourself

Partitions move. Nodes are added and removed, data grows unevenly, partitions are split. Moving them is called rebalancing, and it is a common contributor to incidents because it moves data and changes routing while the system is serving traffic.

Kleppmann’s chapter explains why the naive approach of hash(key) mod N is a bad idea: changing the number of nodes moves almost every key. Real systems use a fixed number of partitions assigned to nodes, partitions that split as they grow, or a number of partitions proportional to the number of nodes. Each moves less data, but none moves nothing.

He also warns about fully automatic rebalancing combined with automatic failure detection. An overloaded node responds slowly, other nodes conclude it is dead, partitions are moved away from it, the move adds load to the remaining nodes and to the network, and the problem spreads. That is a cascading failure built entirely from safeguards. The faults vs failures article discusses the general shape: a tolerance mechanism that turns a brief fault into a long outage.

During an investigation, treat any rebalancing in the window as a suspect until ruled out:

  • Did a rebalance start, run or finish during the incident?
  • What triggered it: an operator, a schedule, an autoscaler, a failure detector?
  • How much data moved, and over which links?
  • Did the incident’s start and end line up with the move?

Routing that goes stale

Something has to know which node owns which partition: a coordination service, a routing tier, or the clients themselves. After a rebalance, every component that caches the assignment has to update. Clients that do not will send requests to a node that no longer owns the partition, and depending on the system they get a redirect, an error, or in the worst case a stale answer.

The evidence pattern is errors or redirects concentrated on the partitions that moved, from the clients that had not refreshed their routing, starting at the moment of the move. Consumer group rebalances in log-based message brokers are a related case: while partitions are being reassigned among consumers, consumption can pause, and a consumer that keeps working on a partition it no longer owns can produce duplicates.

Partial failures: some of it is broken

The hardest partitioned-system incidents are not slow; they are incomplete. One partition is unavailable or behind, and the system keeps working without it.

  • A search query returns results from the partitions that answered in time, without saying that one did not.
  • A report sums the partitions it could read and presents the total as complete.
  • A batch job reads every partition, skips one that times out, logs a warning and exits successfully.
  • A stream consumer is current on all partitions but one, so dashboards built from it are mostly up to date.

From the user’s side these look like missing data, not like an outage. “Some orders are not in the report.” “This customer’s records don’t show up in search.” Nothing errored. The design choice to return partial results was probably reasonable, but if the response does not say it is partial, every downstream consumer treats it as complete.

When the symptom is “some data is missing” and the data is partitioned, map the missing records to their partitions before anything else. If they all belong to one partition, the investigation is about that partition’s availability or lag at the time the data was read, and about the code path that accepted a partial result as complete. The article on pipelines that succeed with missing rows covers the same pattern at the level of a data pipeline.

Investigating an incident in a partitioned system

The method is hypothesis-driven debugging with one addition at the start: split the symptom by partition first.

  1. Split the symptom. Latency, errors, lag or missing records by shard, key range, tenant, region or queue partition. Note which slices are affected and which are not.
  2. Compare the affected slice with its peers and with its own past. Is it hotter than its neighbours, or hotter than it was last week, or both?
  3. Ask what is different about that slice. A specific key, a node, a recent move, a larger data volume, a different configuration.
  4. Write rival hypotheses from different causes. Load, placement, movement and routing are the usual families.
  5. Pick the test that discriminates. Usually a per-key breakdown, a placement history, or a rebalance timeline.
HypothesisPredictsRuled out if
Hot keyOne key’s share of traffic or data jumped; its partition is hotLoad on the hot partition is spread across many keys at their usual rates
Hot node, not hot partitionEvery partition on one node is slow, whichever keys they holdPartitions moved off the node stay slow on their new node
Rebalance in progressSymptom starts and ends with data movement; network and disk busyNo rebalance or partition movement in the window
Stale routingErrors or redirects from some clients for moved partitions onlyErrors also come from clients with fresh routing, or partitions did not move
Uneven growthA partition grew gradually past a threshold; problem builds slowlyThe partition’s size is in line with its peers and with last week
Partial results acceptedMissing data maps to one partition that was slow or unavailable at read timeMissing records span many partitions evenly

A worked example: one tenant, one shard

This is an illustrative example in a familiar shape; the numbers are invented for the explanation.

Symptom. A multi-tenant API’s p99 latency rose from about 300 ms to about 2.5 s on Thursday morning. Error rate is up slightly, mostly timeouts. The database cluster’s average CPU is 35%, the same as the previous Thursday. The on-call engineer’s first instinct is a slow query introduced by Wednesday’s deploy.

Splitting the symptom. Broken down by shard, eleven of twelve shards look normal. Shard 7 is at 95% CPU, and nearly all of the slow requests are for tenants on shard 7. The deploy hypothesis is already weak: a slow query in new code would affect every shard.

Hypotheses.

  • H1: one tenant on shard 7 sharply increased its request volume (hot key).
  • H2: a rebalance moved a large partition onto shard 7 overnight (movement).
  • H3: the host running shard 7 is degraded, for example by a noisy neighbour or a failing disk (hot node).

Discriminating test. A per-tenant request count for shard 7, this hour against the same hour last week, separates H1 from the others immediately. One tenant went from about 3 requests a second to about 450. The others are at their usual rates. The cluster’s events show no partition movement since Monday, which rejects H2. H3 predicts every tenant on the node slows down evenly; the other tenants’ own queries take their usual time when they are not queued behind the busy one, which weakens it, and moving the busy tenant’s partition off the host would be the definitive test if needed.

Confirmation. A second, independent line of evidence comes from the tenant’s side: the tenant’s support ticket from Wednesday evening says they enabled a new sync integration, and the request logs show it calling a list endpoint every two seconds, each call scanning the tenant’s whole order history. The code for that endpoint has no pagination limit for this tenant’s plan.

Finding. “One tenant’s new integration increased its request volume about 150 times. Because tenant ID is the partition key, the whole load landed on shard 7. The list endpoint scans the full history on every call, and there is no per-tenant rate limit.” The action items aim at the mechanism: per-tenant rate limits, pagination on the endpoint, and a per-shard latency alert so the next hot tenant is visible in minutes. The rejected deploy hypothesis is worth recording: it was the team’s first instinct, and the per-shard split ruled it out before anyone read a diff.

Making partitions investigable

Partitioned systems are hard to investigate mostly because the evidence is aggregated before anyone sees it. Some cheap changes help:

  • Log the partition, shard or tenant with every request and job record. Splitting the symptom should be a filter, not a reconstruction.
  • Keep per-partition metrics, not only cluster averages. Latency, CPU, size, lag. Alert on the worst partition, not the mean.
  • Track the top keys by volume, ideally as a time series, so a jump in one key’s share is visible.
  • Record rebalances and partition moves as events with start, end, trigger and volume, so they show up next to the incident timeline.
  • Make partial results explicit. A response, report or job that ran without some partitions should say which ones, and downstream code should decide deliberately whether that is acceptable.

None of these require new infrastructure. They require deciding that “which partition?” is a question every incident will ask.

Frequently asked questions

What is a hot partition?

A hot partition is a partition that receives a disproportionate share of reads, writes or data compared with the others. Because each partition is served by one node or a small set of replicas, a hot partition can be overloaded while the cluster as a whole has plenty of spare capacity. Common causes are a single very busy key, sequential keys in a range-partitioned store, and one large tenant or entity that dominates its partition.

How do I find a hot key?

Group requests, writes or records by their partition key for the incident window and compare each key’s share with a healthy period. Logs are often the fastest source if they include the key; otherwise, a read-only query against a request, audit or event table works. Look for a key whose share jumped, not just the largest key, because the largest tenant or product is usually large every day.

Does consistent hashing prevent hot spots?

No. Hash-based partitioning, including consistent hashing, spreads many different keys evenly across partitions, and it reduces how much data moves when nodes are added or removed. It cannot split a single key: every request for one key still goes to the partition that owns it. Hot keys need a separate mitigation, such as splitting the key with a suffix, caching, or limiting the load that one key can generate.

Why is one partition of a consumer lagging when the others are current?

Usually because more data, or more expensive data, is arriving on that partition. Producers that partition by key send every message for a busy key to the same partition, and the consumer that owns it falls behind. Other causes are a slow or stuck consumer instance, a poison message that is retried repeatedly, and a recent rebalance that paused or reassigned the partition. Compare that partition’s incoming rate and per-message processing time with its peers to tell them apart.

What is a partial failure?

A partial failure is when some parts of a distributed system fail while others keep working. In a partitioned system it typically means one partition is unavailable, slow or behind while the rest are healthy. Partial failures are hard to detect because overall metrics look normal, and they are hard to reason about because the effect depends on which data each request happens to touch.

Never trust an average in a partitioned system

Partitioning trades a single point of load for many local ones, and incidents in partitioned systems are almost always local. The investigation discipline that follows is simple to state and easy to forget under pressure: split the symptom by partition before forming a hypothesis, and compare the affected slice with its peers and its own past. Most hot-partition incidents are diagnosed in that step, and most wasted hours are spent skipping it.

Monitoring is the right tool for the split itself; observability and root cause analysis explains where detection ends and investigation begins, and our Datadog comparison is specific about which side each tool is on. Decim works on the investigation side: it reads code from GitHub, logs from Google Cloud Logging and tickets from Jira, and weighs rival explanations against cited evidence, as the investigations page describes. It does not read metrics, so per-shard CPU would still come from your monitoring. For where incident time actually goes, see reducing MTTR.


Decim investigates incidents in your own system and returns a diagnosis where every claim links to the log line, code or check behind it, with the rejected explanations kept so your team learns how its partitions really behave. It reads code from GitHub, logs from Google Cloud Logging and tickets from Jira, never runs SQL and never merges a fix. Learn more at decim.dev or see pricing.

Decim investigates pipeline incidents

It reads your code, logs and tickets, works through the pipeline step by step, and confirms the cause with evidence you can check: every claim links to the log line, commit or check behind it. Then it proposes the fix and writes the report.

Request a demo

← All articles