The temptation and the trap
Sharding location data by region keeps nearby queries on one shard, which is great for proximity reads. The trap is that activity is wildly uneven: a dense downtown generates far more traffic than an empty desert, so a naive geographic shard becomes a hot shard that saturates while others idle.
Taming the hot region
- Finer cells where it is busy. Use a variable resolution scheme like S2 or a quadtree so dense areas split into more, smaller shards.
- Split the hot key. When one cell is still too hot, subdivide it or spread it across replicas so load fans out.
- Adaptive boundaries. Monitor load per shard and rebalance boundaries as traffic patterns shift through the day.
Keeping proximity correct
Because a nearby query can cross a shard boundary, the query layer must scatter the request to the few shards a search window touches and gather the results. The goal is small, balanced shards that still keep most queries local.
Key idea
Geo sharding must subdivide hot dense regions into smaller balanced shards while a scatter gather layer keeps cross boundary proximity queries correct.