惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
T
Tenable Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Scott Helme
Scott Helme
C
Cisco Blogs
T
Tor Project blog
P
Privacy International News Feed
Forbes - Security
Forbes - Security
S
Schneier on Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy & Cybersecurity Law Blog
Know Your Adversary
Know Your Adversary
T
The Exploit Database - CXSecurity.com
Security Latest
Security Latest
T
Threatpost
S
Security @ Cisco Blogs
H
Heimdal Security Blog
L
LINUX DO - 热门话题
N
News | PayPal Newsroom
N
News and Events Feed by Topic
Hugging Face - Blog
Hugging Face - Blog
T
Troy Hunt's Blog
WordPress大学
WordPress大学
腾讯CDC
V
V2EX
IT之家
IT之家
P
Proofpoint News Feed
S
Securelist
Hacker News: Ask HN
Hacker News: Ask HN
T
Threat Research - Cisco Blogs
爱范儿
爱范儿
雷峰网
雷峰网
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Recent Commits to openclaw:main
Recent Commits to openclaw:main
The Cloudflare Blog
美团技术团队
月光博客
月光博客
博客园 - Franky
小众软件
小众软件
V
Vulnerabilities – Threatpost
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志

iyear - 记录本是反抗

LFX Mentorship: 与 KubeVela 社区在开源相遇 - iyear OSPP2022 + DevStream社区 复盘 - iyear 《图解TCP/IP》读后感 - iyear - 记录本是反抗 分布式 · 一致性哈希 - iyear 3200元32G1TSSD开发机DIY选型经历 - iyear - 记录本是反抗 企鹅电竞WebSocket弹幕协议浅析 - iyear - 记录本是反抗 2021 - iyear - 记录本是反抗 在N1小钢炮上搭建私有音乐库koel - iyear - 记录本是反抗 尝试理解前后端分离 - iyear - 记录本是反抗
Redis · 为什么哈希槽数为16384? - iyear
博主: iyear · 2022-04-16 · via iyear - 记录本是反抗

Redis · 为什么哈希槽数为16384?

 • 

缘由: 学习 Redis 时认为奇怪的数字&HashSlot引出

浅析

Redis Slot 采用的是 CRC16 算法,输出集合有 2^16-1=65535 种结果。而 16384 = 2^14,为什么要少两位?

相关讨论: https://github.com/redis/redis/issues/2576

1 缩减通讯消息体

https://github.com/redis/redis/blob/a642947e04168b40aea6cec666927a9e653035e6/src/cluster.h#L120

Redis Cluster 定义的 clusterNode 需要携带自己的 slots 以及一定数量其他节点的信息(包括 slots)

solts 相当于一个 BitMap, 16384b = 2KB , 65535b = 8KB

Redis Cluster 需要发送心跳包通讯,在节点数量较大时,过大的消息体会导致节点通讯较慢且浪费带宽

2 Master不应当过多的前提

At the same time it is unlikely that Redis Cluster would scale to more than 1000 mater nodes because of other design tradeoffs.

作者认为,Redis ClusterMaster Node 架构设计时不应当超过1000个,否则节点间的通信将占用大量的网络IO,导致整体性能反而下降

在这一前提下,过多的插槽是没有必要的。反而如果大量的插槽占据 slots,会导致其压缩率下降

参考

  1. https://www.fushengwushi.com/archives/1616
  2. https://www.cnblogs.com/rjzheng/p/11430592.html