New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why redis-cluster use 16384 slots? #2576

Closed
qunchenmy opened this Issue May 12, 2015 · 5 comments

Comments

Projects
None yet
5 participants
@qunchenmy
Copy link

qunchenmy commented May 12, 2015

why redis-cluster use 16384 slots? crc16() can have 2^16 -1=65535 different remainders。

@antirez

This comment has been minimized.

Copy link
Owner

antirez commented May 12, 2015

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.

@antirez antirez closed this May 12, 2015

@medusar

This comment has been minimized.

Copy link

medusar commented Mar 12, 2016

Hey,i have two questions about you answer:

  1. why 8K of space is prohibitive using 65 slots?
  2. why the bitmap should be compressed?
@foojolt

This comment has been minimized.

Copy link

foojolt commented Mar 17, 2016

@medusar

  1. not 65, that's 65k = 8 * 8 (8 bit/byte) * 1024(1k) = 8K bitmap size
  2. Compress bitmap to reduce network traffic
@medusar

This comment has been minimized.

Copy link

medusar commented Mar 17, 2016

@foojolt thank you very much

@courage007

This comment has been minimized.

Copy link

courage007 commented 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment