3 ms·
Personally, I would prefer to hash my fields like this: 1. Hash each field in the key in some fashion 2. Concatenate the hashes, for example implode(".", $has
by EGreg 16y ago
Personally, I would prefer to hash my fields like this:
1. Hash each field in the key in some fashion
2. Concatenate the hashes, for example implode(".", $hashes)
3. Now you've got a point in the space of all possible concatenated hashes. On each client, have a partition like this for each key:
["", "abf34.9f8c7.92833", ...]
4. go through the partition and find the last point that is smaller than your point. That point maps to your shard.
5. Monitor your machines. If one of your shards becomes too full, or too much action is going, SPLIT IT. You do this simply by replicating the data to one or more new shards (like it says in the article) introducing one or more points in the partition right after the point mapping to the shard. Point them to the new shards. And update all the clients!
That's all
Greg