6 ms·
Interesting writeup. The thing it seems to not address is that a different sharding model might have not worked for foursquare's data access needs. In this http
by andrewjshults 16y ago
Interesting writeup. The thing it seems to not address is that a different sharding model might have not worked for foursquare's data access needs. In this http://news.ycombinator.com/item?id=1769982 http://news.ycombinator.com/item?id=1769982 HN post harryh alludes to the fact that using user ID as the shard key was a design decision. Their current design requires that an entire user's checkin history be able to be loaded for calculating badges so sharding by user ID might have been necessary to guarantee not having the performance overhead of multi-server retrievals. From reading the various write ups it seems like the real problems (using the current load all data for badge calculations method) came from getting too close to the max memory and then the issue that foursquare's checkins weren't filling full pages so migrating data didn't actually give nodes 1 & 2 any place to write new data to (in memory) until after compaction could be performed.
- megaman821 16y agoWhy not shard by check-in id and map/reduce to get the badge calculation? When sharding by user id, no solution is going to lead to a balanced cluster since some users will always be more active than others. If map/reduce takes to long, batch it and return the badge calculation later.
- ddlatham 16y agoIf the data was sharded by user ids and some ranges of user ids were more active than other user ids, why not shard by a hash of the user id. In that case all the data for a given user id would live in a single shard, but active ranges of users would be broken up across shards. If any single user is creating too much data for a single shard, you've got other problems.
- ericflo 16y agoWhy should getting someone's badges require any "calculation" at all?