亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

redis之槽個數

標簽:
Redis
  • redis的槽的个数是16384个,为什么呢?2^14个?

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.

Google翻译为:

原因是:正常的心跳包携带节点的完整配置,可以用旧的幂等方式替换以更新旧配置。 这意味着它们包含原始形式的节点的插槽配置,它使用2k空间和16k插槽,但使用65k插槽将占用8k空间。 同时,由于其他设计权衡,Redis Cluster不太可能扩展到超过1000个主节点。 所以16k在正确的范围内确保每个主站有足够的插槽,最多1000个主,但是足够小的数字可以很容易地将插槽配置传播为原始位图。 请注意,在小型集群中,位图难以压缩,因为当N很小时,位图将设置插槽/ N位,这是设置的大部分位。

数学:

2k空间 = 2k byte = 2 * 1024 byte = 2 * 1024 * 8 bit = 2^14 bit = 16384 bit = 16384个槽

16k插槽 = 16k个 = 16k bit = 16 * 1024 bit = 16 * 1024 / 8 byte = 2k byte

同理:

65k个插槽 = 65k bit = 8k byte = 8k空间


點擊查看更多內容
1人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
JAVA開發工程師
手記
粉絲
2
獲贊與收藏
9

關注作者,訂閱最新文章

閱讀免費教程

感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消