You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
zhangjie2012, artikell, ccc7574, bhuvanvenkat-plivo, Kidlovec and 160 morelifeIncredible, qijianyeah, 8bun, YuQuankun and WangGetAllzcr20090430
How to understand the sentence not 65, that's 65K = 8 * 8 (8 bit/byte) * 1024 (1k) = 8K bitmap size?@foojolt
crc16() can have 2^16 -1=65535, which means the bitmap has 65535 bits. so the size of the bitmap can be calculated by 65535 / 8 (8bit/byte)/1024(1k)=7.99 Kbytes.
How to understand the sentence not 65, that's 65K = 8 * 8 (8 bit/byte) * 1024 (1k) = 8K bitmap size?@foojolt
crc16() can have 2^16 -1=65535, which means the bitmap has 65535 bits. so the size of the bitmap can be calculated by 65535 / 8 (8bit/byte)/1024(1k)=7.99 Kbytes.
Hi, I didn't find where to compress the slots bitmap in source code, did I miss something?
How to understand the sentence not 65, that's 65K = 8 * 8 (8 bit/byte) * 1024 (1k) = 8K bitmap size?@foojolt
crc16() can have 2^16 -1=65535, which means the bitmap has 65535 bits. so the size of the bitmap can be calculated by 65535 / 8 (8bit/byte)/1024(1k)=7.99 Kbytes.
Hi, I didn't find where to compress the slots bitmap in source code, did I miss something?
This is issue is quite old, yet I was asked this same question for so many times even after @antirez had already given his answer. Maybe it's the language gap. I think @antirez has already made it clear in English, and I don't want to be superfluous. Following is my understanding in Chinese: 总结: 1、消息大小考虑:尽管crc16能得到65535个值,但redis选择16384个slot,是因为16384的消息只占用了2k,而65535则需要8k。 2、集群规模设计考虑:集群设计最多支持1000个分片,16384是相对比较好的选择,需要保证在最大集群规模下,slot均匀分布场景下,每个分片平均分到的slot不至于太小。
Activity
antirez commentedon May 12, 2015
The reason is:
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.
exceptionplayer commentedon Mar 12, 2016
Hey,i have two questions about you answer:
mind4s commentedon Mar 17, 2016
@Medusar
exceptionplayer commentedon Mar 17, 2016
@foojolt thank you very much
courage007 commentedon Jun 29, 2017
why:
16k was in the right range to ensure enough slots per master with a max of 1000 maters.
what is the logic in the background?
guoruibiao commentedon Jun 21, 2019
thx. The balance of bitmap's size and number of master is the key.
qfl19911216 commentedon Jul 23, 2019
what is other design tradeoffs? @foojolt
qfl19911216 commentedon Jul 23, 2019
8K bitmap size means that bitmap size is 8 bits? @foojolt
qfl19911216 commentedon Jul 23, 2019
How to understand the sentence not 65, that's 65K = 8 * 8 (8 bit/byte) * 1024 (1k) = 8K bitmap size?@foojolt
haiyuzhu commentedon Oct 24, 2019
crc16() can have 2^16 -1=65535, which means the bitmap has 65535 bits. so the size of the bitmap can be calculated by 65535 / 8 (8bit/byte)/1024(1k)=7.99 Kbytes.
cqlxcnp commentedon Oct 30, 2019
Thanks for answers
shao-h commentedon Apr 16, 2020
Hi, I didn't find where to compress the slots bitmap in source code, did I miss something?
trevor211 commentedon Apr 17, 2020
No compression, just 1 bit for 1 slot.
See the code: https://github.com/antirez/redis/blob/ac441c741379dd4002f664c81047e8412cb793d0/src/cluster.h#L117
sjclijie commentedon Sep 28, 2020
mark
14 remaining items
holiday-jq commentedon Sep 16, 2022
mark
2227324689 commentedon Oct 16, 2022
mark
walterlife commentedon Nov 12, 2022
mark
xp-go commentedon Apr 11, 2023
Why isn't slot 8192?
uestccls commentedon Jul 27, 2023
m
ysong6 commentedon Jan 9, 2024
mark
softsheng commentedon Mar 5, 2024
mark
zhangyizong commentedon Mar 5, 2024
bubua12 commentedon May 27, 2024
Mark
zhangyizong commentedon May 27, 2024
YvCeung commentedon Dec 16, 2024
wow,subject representative!