95

一致 Hash 算法分析 | crossoverJie's Blog

 6 years ago
source link: https://crossoverjie.top/2018/01/08/Consistent-Hash/?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
当我们在做数据库分库分表或者是分布式缓存时,不可避免的都会遇到一个问题:如何将数据均匀的分散到各个节点中,并且尽量的在加减节点时能使受影响的数据最少。Hash 取模随机放置就不说了,会带来很多问题。通常最容易想到的方案就是 hash 取模了。可以将传入的 Key 按照 index = hash(key) % N 这样来计算出需要存放的节点。其中 hash 函数是一个将字符串转换为正整数的哈

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK