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

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

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