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

推荐订阅源

T
Tenable Blog
H
Heimdal Security Blog
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Schneier on Security
G
GRAHAM CLULEY
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
P
Proofpoint News Feed
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
S
Security Affairs
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
N
News | PayPal Newsroom
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU

iyear - 记录本是反抗 - 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 - 记录本是反抗 - 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