Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
About: consistent hashing
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Harukasan
PRO
February 27, 2017
Technology
250
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
About: consistent hashing
Harukasan
PRO
February 27, 2017
More Decks by Harukasan
See All by Harukasan
Harucom Follow-up
harukasan
PRO
1
51
Building a Standalone Programming Environment
harukasan
PRO
1
2.2k
Successor to PicoRabbit: Ruby Programming Envorinment / RubyKaigi 2025 follow up
harukasan
PRO
1
1.4k
Write your own mrbgem, Create your own device
harukasan
PRO
1
480
PicoRabbit: a Tiny Presentation Device Powered by Ruby
harukasan
PRO
2
1.9k
pixivを支える技術 / 技育CAMPアカデミア
harukasan
PRO
3
630
20240401 新卒研修 - ピクシブにおける技術領域
harukasan
PRO
1
970
ピクシブのコンテンツ配信基盤技術 / pixiv TECH SALON
harukasan
PRO
5
6k
Goにおける画像ファイル処理 / golang.tokyo #19
harukasan
PRO
7
6.9k
Other Decks in Technology
See All in Technology
20260929_AmazonGuardDutyの検出通知メールにAWS DevOpsAgentの調査結果を追加する
yhana
1
410
【ゲームメーカーズスクランブル2026】『Shadowverse: Worlds Beyond』UIとアニメーションで実現する最高のユーザー体験を叶えるプロトタイピング
cygames
PRO
1
710
BedrockとLambdaで作る リアルタイム進行型推理ゲーム
kawametho
0
150
スキルを作る、その前に!複数人で使われるスキルを 作るためのプロセス
junkifurukawa
1
150
1万名の社員が使う認証基盤で どう信頼性を担保するか?
kairim0
0
150
インバスケット試験対策アプリを 作って見えたAIエージェント構築 ナレッジ2選
shichijoyuhi
0
100
【データ横丁主催】AI Agentがコンテキストを使って仕事をした後、何が残るのか― 組織の経験を次の判断に引き継ぐ「Agent Memory」
shisyu_gaku
2
310
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
280
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
1.5k
Claude Designがめちゃくちゃ便利なので使ってほしい
diggymo
0
190
あなたの知らないAmazon VPC Route Server/Amazon VPC Route Server you don't know about
masakiokuda
1
200
サーバーフルコンピューティング?AWS Lambda
iwatatomoya
0
120
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
4
520
RailsConf 2023
tenderlove
30
1.6k
Designing Experiences People Love
moore
143
24k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1k
WENDY [Excerpt]
tessaabrams
14
40k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Faster Mobile Websites
deanohume
310
32k
Transcript
ӋԍӏӑӞԍӠӧӜӏӾʂҍ҅ѥ҈ ӬӆӏӮװɒױґҭѭѷҵ
ѵѵ҉ѥѧӧӜӏԍӇҊґ
ΌҐӄـҴΌҐӦـӡҍðҬƾ҈ҁѥ Ҋѥѧī
ֿ ׀ ׁ ׅ ׆ ׇ ֿ־ ֿ ׀ ׁ
ׂ ׃ ׄ ӄـ Ӧـӡ
ֿ ׀ ׁ ׅ ׆ ׇ ֿ־ ֿ ׀ ׁ
ׂ ׃ ׄ ˅ˤҍґѵѧҌ҆҈ҝѹѥ Ӧـӡ
ѵҮѮ҉ѯҭҊ ؆!ҐӏӼـӟҺԍӇ ؆ӄӼӜӏӾҐåࢄشࠓ´҆҈ҭҥ҅ ؆Ҍҍѭѣҭҥ҅ҴҌҵѭͮѥײѺҍåð ……ҊѭҠѣѥүѥүҊ¸ê
˕ӏԍӯԃҌȠʂ פӺӐӾԅʂץ
ֿ ׀ ׁ ֿ ׀ ׁ %3 = 1 %3
= 2 %3 = 0 ׂ %3 = 1 ӺӐӾԅʂ ӦـӡҐ²ҴҊҭ ׃ ׄ %3 = 2 %3 = 0
ӺӐӾԅʂ ؆ÅҬѮχѵҫҌѱ҈ͮѷѿѧ ؆ӏԍӯԃ ؆ӦـӡҴϟՃѻҭҊѯҍŖő
ӺӐӾԅʂ ֿ ׀ ׁ ֿ ׀ ׁ %3 = 1
%3 = 2 %3 = 0 ׂ %3 = 1 ׃ ׄ %3 = 2 %3 = 0
ӺӐӾԅʂ ׂ ֿ ׀ ׁ ֿ ׀ ׁ %3 =
1 %3 = 2 %3 = 0 ׂ %3 = 1 ׃ ׄ %3 = 2 %3 = 0
ֿ ׀ ׁ ֿ ׀ ׁ %4 = 1 %4
= 2 %4 = 3 ׂ %4 = 0 ӺӐӾԅʂ ׂ ׃ ׄ %4 = 1 %4 = 2 ӦـӡҴϟՃѻҭҊѯҍŖő ׀¦߱ѻқ҈҉ȳѯȈѩѮˠੜ
פӺӐӾԅʂץґ ࣮ΆѮ؆୯҂ѮӦـӡҐϟՃ؏আѮŖő
ӋԍӏӑӞԍӠӧӜӏӾʂ • @_LE@YJFYF[@Q،TSZLZ[FS[ @ZKLSJ@SE@SETR YFFZLZ[YLC\[FE@DKLSJYT[TDTQZITYFQLF_LSJ T[ WT[ZTS[KF"TYQE"LEF"FC،ׇׇֿׅׯ • ࣮ΆҊѹ҈ґFRD@DKFEҐҁңҐF[@R@ѮȵĚ K[[WZזזJL[K\CאDTRזזPF[@R@
• SJLSaW@DKFY@IILDFY_FYҤ࠾ˉ
ӋԍӏӑӞԍӠӧӜӏӾʂ ؆ӧӜӏӾВґɠҍåƖѻҭґѼ ؆ӧӜӏӾВҴԂԍӇ ҍѹ҈࣮Ά
ֿ ׀ ׁ ӋԍӏӑӞԍӠӧӜӏӾʂ ӦـӡӄـҐѿҮҀҮҴęѺӧӜӏӾ̌БҍࣹӨ @ZK @ZK @ZK ׯ ׯ
ׯ ӧӜӏӾ̌Б
ֿ ׀ ׁ @ZK @ZK @ZK ׯ ׯ ׯ ӧӜӏӾ̌Б
ֿ ׀ ׁ ׂ ׃ ׄ @ZK @ZK @ZK @ZK @ZK @ZK ׯ ׯ ׯ ׯ ׯ ׯ ӋԍӏӑӞԍӠӧӜӏӾʂ ӦـӡӄـҐѿҮҀҮҴęѺӧӜӏӾ̌БҍࣹӨ
ֿ @ZK ׯ ֿ ׀ ׁ @ZK @ZK @ZK ׯ
ׯ ׯ ۙѥÃҴબ ֿ ׀ ׁ ׂ ׃ ׄ @ZK @ZK @ZK @ZK @ZK @ZK ׯ ׯ ׯ ׯ ׯ ׯ ֿ˕ ҐÃҴҊҭ ؼ ӧӜӏӾ̌Б ӋԍӏӑӞԍӠӧӜӏӾʂ ӦـӡӄـҐѿҮҀҮҴęѺӧӜӏӾ̌БҍࣹӨ
ӋԍӏӑӞԍӠӧӜӏӾʂ ؆ӧӜӏӾВґɠҍåƖѻҭґѼ ؕҌҐ҉ÅҫҌѥ ؆ȳѯȈҰҭҐґӧӜӏӾ̌БҐ϶҂ѳҐґѼ ؕҌҐ҉ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ
ֿ ׀ ׁ ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ @ZK @ZK @ZK ׯ ׯ ׯ
ӧӜӏӾ̌Б ֿ ׀ ׁ ׂ ׃ ׄ @ZK @ZK @ZK @ZK @ZK @ZK ׯ ׯ ׯ ׯ ׯ ׯ
ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ ӧӜӏӾ̌Б ֿ ׀ ׁ ׂ ׃ ׄ @ZK @ZK
@ZK @ZK @ZK @ZK ׯ ׯ ׯ ׯ ׯ ׯ ֿ ׀ ׁ @ZK @ZK @ZK ׯ ׯ ׯ ׂ @ZK ׯ ׂҴϟՃ
ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ ӧӜӏӾ̌Б ֿ ׀ ׁ ׂ ׃ ׄ @ZK @ZK
@ZK @ZK @ZK @ZK ׯ ׯ ׯ ׯ ׯ ׯ ֿ ׀ ׁ @ZK @ZK @ZK ׯ ׯ ׯ ۙѥÃҴબ ׂ @ZK ׯ ȳѯȈҰ҆ҁҐґׄ҂ѳ
ӋԍӏӑӞԍӠӧӜӏӾʂ ؆ÅҫҌѥ ؆ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ
ӧӜӏӾ̌Б ֿ @ZK ׯ ˅ˤҍґ ؟ֿذ׀
˅ˤҍґ ӧӜӏӾ̌Б ֿ ׀ @ZK @ZK ׯ ׯ ׀ҴϟՃѻҭҊ ؟ֿذ׀׃־أ
ӧӜӏӾ̌Б ֿ ׀ @ZK @ZK ׯ ׯ ׁ @ZK ׯ
˅ˤҍґ ؟׀ذׁ׀׃أ ׁҴϟՃѻҭҊ
ӧӜӏӾ̌Б ֿ ׀ @ZK @ZK ׯ ׯ ׁ @ZK ׯ
ׂ @ZK ׯ ˅ˤҍґ ؟ׁذׂ׀׃أ ׂҴϟՃѻҭҊ
ӋԍӏӑӞԍӠӧӜӏӾʂ ؆ÅҫҌѥ ؆ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ
ӋԍӏӑӞԍӠӧӜӏӾʂҐ࣮Ά F[@R@ҐńĘׯ
# ϋογϡؔ32bit unsigned intͷϋογϡΛฦ͢ # CRC32, MD5ͷ্Ґ32bitͳͲͰ࣮ func hash(key string)
uint32 { ... } # ϊʔυͷϋογϡΛܭࢉ for _, node := range nodes { # ͻͱͭͷϊʔυຖʹ160ݸͷϋογϡΛܭࢉ for i := 0; i < 160; i++ { k := fmt.Sprintf(“%s-%d”, node, i) # ϊʔυ໊ͱϋογϡͷϖΞΛՃ continuum.add(node, hash(k)) } } # ϋογϡͰιʔτ͓ͯ͘͠ sort.Sort(continuum) ֿאӦـӡӶӜӯҐܭࢉ
ֿאӦـӡӶӜӯҐܭࢉ ӧӜӏӾ̌Б ֿ @ZK ׯ ֿ҅ҐӦـӡҍରѹ ΌҐӧӜӏӾҴܭࢉ ذӧӜӏӾܭࢉҍҩҭÅҬҴЕɦ ؕ׀־־¿ѱҫѥ҉ůŲׯ
# ϋογϡͰιʔτ͓͚ͯ͠ೋ୳ࡧͰ୳ࡧͰ͖Δ func search(key string) string { v := hash(key)
i, j := 0, n for i < j { h := i + (j-i)/2 if (continuum.values[i] > v) { i = h + 1 } else { j = h } } return continuum.nodes[i] } ׀אӧӜӏӾҐ୳ࡧ
׀אӧӜӏӾҐ୳ࡧ ӧӜӏӾ̌Б _ @ZK ׯ ֿ ׀ ׁ @ZK @ZK
@ZK ׯ ׯ ׯ ׂ @ZK ׯ å୳ࡧ҉˕ۙѥӧӜӏӾҴʹŲ
ҠҊң ӋԍӏӑӞԍӠӧӜӏӾʂׯ ؆ÅҫҌѥ ؕӧӜӏӾВҊѹ҈ґ׃ ¯ׁ׀CL[ׁ׀ !؆ֿ̙ ؆ϟՃѹҁҊѯҐӘӹـӐѮƀҌѥ ؆࣮ΆҤӏԍӯԃ