Database sharding strategy trade-offs? like, what are the pros and cons?
Radmila Kovačević
·1937 views
Hey everyone, I'm trying to figure out the best way to shard our main user database. We're growing super fast, and the single instance is starting to slow things down. I've been looking at a few ideas, like using the user ID as the shard key, or maybe sharding by geographic region. Both have their own tricky parts. Sharding by user ID seems like it would be more balanced over time, but then figuring out how to handle queries across shards for stuff like global leaderboards is a real pain. Sharding by region makes some of the latency stuff easier, but you could end up with a super busy shard if one area really takes off. What did you guys run into when you picked your sharding strategy? Any horror stories or favorite approaches?
33 comments