Data Distribution and Hotspots
What you'll learn: How choosing the wrong shard key creates uneven workload distribution that crushes database performance.
The Problem with Uneven Distribution
When you shard a database, the shard key determines which data goes to which shard. A poor choice doesn't just affect where data lives—it creates hotspots: shards that handle dramatically more traffic than others.
Think of sharding like dividing customers across checkout lanes at a grocery store. If you assign lanes by "first letter of last name," and 40% of customers have last names starting with 'S' or 'M', those lanes become overwhelmed while others sit idle. That's a hotspot.
How Hotspots Form
Skewed data distribution happens when certain shard key values are far more common than others. If you shard users by country and 80% live in the US, that one shard drowns in traffic.
Temporal hotspots occur when recent data gets disproportionate access. Sharding by timestamp means the newest shard handles all writes and most reads (people care about recent activity), while older shards sit nearly empty.
Celebrity/influencer effect creates hotspots when specific entities generate massive traffic. Sharding social media posts by user ID works fine—until one shard contains a celebrity with millions of followers, and every read/write to their content hammers that single shard.
The Consequences
A hotspot shard experiences high CPU, memory pressure, slow queries, and eventually becomes the bottleneck for your entire system. Meanwhile, other shards remain underutilized. You've added complexity without gaining scalability.
Key Takeaway: Poor shard key selection creates unbalanced load distribution, turning one or more shards into performance bottlenecks that defeat the purpose of sharding—monitor data distribution patterns and choose keys that spread load evenly.