Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • so for hash based method 1 you explained, we need to arrange them in form of ring as in consistent hashing and then allocate ranges to each nodes,am i correct? Commented Feb 10, 2021 at 17:40
  • Not sure I can parse your question. In method 1, the hash points to the machine/machine set its located on. When the number of machine/machine sets change in the database it can change to which machine/machine set the same hashed value points to. You could make each shard independent of a machine/machine set with a cross-walk table, but if that is the case you are better to follow method 2, and partition the data instead. Commented Feb 10, 2021 at 21:31
  • method 2 can can have unbalanced partitions. What i asked was our hash fxn will be of form hash(key)%n, and now if n changes by adding or deletion of db nodes, it will effect all mappings, as new has fxn will be hash(key)%(n+1) ,assume a new db server is added, how can we make sure we get min. change in existing mappings by change of hash fxn. IS consistent hashing is the answer to this? Commented Feb 11, 2021 at 16:07
  • Method 2: yes, the reason for having a background process break/merge/load balancing them. Method 1: Yes the reason why every shard has to be checked. There is no way to perform consistent hashing because there is no way to obtain a consistent list, except by fiat. And if you are this far, go to method 2. Commented Feb 12, 2021 at 1:09
  • I think we are on different track.What do you mean by "consistent list",If i want to scale my server count up/down later, I would need min. keys movement, so somehow i think strategy like consistent hashing might help. By consistent hashing i mean, servers are arranged in a ring by hash fxn and then keys are also arranged in similar way by going in clockwise direction if no server at hashed location. Commented Feb 13, 2021 at 12:15