redis 为什么 定16384个槽

redis 为什么 定16384个槽2的14次方且不能修改

评论 (0)链接2017-09-07 

具体可以参考redis作者的回答:

The reason is:

  1. Normal heartbeat packets carry the full configuration of a node, that can be replaced in an idempotent way with the old in order to update an old config. This means they contain the slots configuration for a node, in raw form, that uses 2k of space with16k slots, but would use a prohibitive 8k of space using 65k slots.
  2. At the same time it is unlikely that Redis Cluster would scale to more than 1000 mater nodes because of other design tradeoffs.

So 16k was in the right range to ensure enough slots per master with a max of 1000 maters, but a small enough number to propagate the slot configuration as a raw bitmap easily. Note that in small clusters the bitmap would be hard to compress because when N is small the bitmap would have slots/N bits set that is a large percentage of bits set.

https://github.com/antirez/redis/issues/2576

该答案已被锁定,无法对其进行评论,编辑及投票。
()
评论 (0)链接 • 2017-09-20
德问是一个专业的编程问答社区,请 登录注册 后再提交答案