Course contentsShow
← System Design
Lesson 256 of 1,9197. Database Scaling: ShardingFree lesson

Hotspots and Uneven Data Distribution

Recognize how poor shard key choice can cause certain shards to receive disproportionate load.

Hotspots and Uneven Data Distribution

What you'll learn: How a poorly chosen shard key can cause some shards to become overloaded while others sit idle.

The Problem

Even with a well-designed sharding strategy, you can end up with hotspots—shards that receive far more traffic or store far more data than others. This happens when your shard key doesn't distribute data or access patterns evenly across all shards.

Think of it like checkout lanes at a grocery store. If you assign customers to lanes based on the first letter of their last name, lane "S" (Smith, Singh, Sanchez) will be packed while lane "Q" stands empty. You've sharded, but ineffectively.

Common Causes

Skewed data distribution: Some key values are simply more common. If you shard users by country and 60% of users are in one country, that shard holds 60% of the data.

Skewed access patterns: Even if data is evenly distributed, access isn't always. A celebrity user on a social platform generates far more reads/writes than regular users. If you shard by user_id using range-based sharding and celebrities cluster in certain ID ranges, those shards become hotspots.

Temporal patterns: With time-based sharding, the "current" shard (today's data) receives all writes while historical shards sit cold.

The Impact

Hotspots defeat the purpose of sharding. That overloaded shard becomes your bottleneck—it may run out of storage, throttle queries, or crash entirely while other shards remain underutilized. Your system scales horizontally in theory but performs like a single overloaded database in practice.

Key Takeaway: Poor shard key selection creates hotspots where certain shards handle disproportionate load, negating the benefits of sharding and creating new bottlenecks in your distributed system.