Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NoSQL概論
Search
UENISHI Kota
September 11, 2015
Technology
3
820
NoSQL概論
High-level overview on NoSQL
UENISHI Kota
September 11, 2015
Tweet
Share
More Decks by UENISHI Kota
See All by UENISHI Kota
Metadata Management in Distributed File Systems
kuenishi
2
470
Behind The Scenes: Cloud Native Storage System for AI
kuenishi
2
340
Apache Ozone behind Simulation and AI Industries
kuenishi
0
320
Distributed Deep Learning with Chainer and Hadoop
kuenishi
3
1.1k
A Few Ways to Accelerate Deep Learning
kuenishi
0
1k
Introducing Retz
kuenishi
5
1.1k
Introducing Retz and how to develop practical frameworks
kuenishi
3
700
Formalization and Proof of Distributed Systems (ja)
kuenishi
10
6.3k
Mesos Frameworkの作り方 (How to Make Mesos Framework)
kuenishi
7
2.3k
Other Decks in Technology
See All in Technology
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
JuliaTokaiとJuliaLangJaの紹介 for NGK2025S
antimon2
1
120
月間60万ユーザーを抱える 個人開発サービス「Walica」の 技術スタック変遷
miyachin
1
140
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
160
データ基盤におけるIaCの重要性とその運用
mtpooh
4
520
「隙間家具OSS」に至る道/Fujiwara Tech Conference 2025
fujiwara3
7
6.5k
メールヘッダーを見てみよう
hinono
0
110
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
290
dbtを中心にして組織のアジリティとガバナンスのトレードオンを考えてみた
gappy50
0
260
JAWS-UG20250116_iOSアプリエンジニアがAWSreInventに行ってきた(真面目編)
totokit4
0
140
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
350
Featured
See All Featured
RailsConf 2023
tenderlove
29
970
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Side Projects
sachag
452
42k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
30
2.1k
Building an army of robots
kneath
302
45k
Fireside Chat
paigeccino
34
3.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
NoSQL ֓ 2015/9/11 DB Tech Showcase Sapporo Basho δϟύϯ᷂ɹ্߁ଠ
୭ʁ • @kuenishi • Github, Twitter, etc • ࢄγεςϜྺ7 •
Bashoδϟύϯͷํ͔Βདྷ·ͨ͠ • Riak CSͷ։ൃ • ࠷ۙτϥϯβΫγϣϯʹڵຯ ͕͋Γ·͢
Ξϯέʔτ •SQL͡Όͳ͍ͱϦϨʔγϣφϧͳσʔλϕʔ ε࡞Εͳ͍ʁ •ʮཧ͔ΒֶͿσʔλϕʔε࣮ફೖʯΛಡ Μͩʁ •ʮNoSQLͷجૅࣝʯΛಡΜͩʁ •Dynamo? BigTable? Tandem?
ΞδΣϯμ •NoSQLΑ͏Θ͔ΒΜʂԿʁʂͱ͍͏ਓͷͨΊʹɺ ԿͳͷͬͯΛ͠·͢ •͍Ζ͍Ζ͋ͬͯΘ͔ΒΜʂͱ͍͏ਓͷͨΊʹྨ ࣠ʹ͍͓ͭͯ͠·͢ •ͦͷଞɺ༩ଠΛ͠·͢
Relational DBMS •Ұൠతʹ… •ෳͷΫϥΠΞϯτ͔ΒTCP/IPͰଓ͠ •ϦϨʔγϣφϧϞσϧΛ࣮༻Խͨ͠SQLͱ͍͏ݴޠΛΠϯλʔ ϑΣʔεͱ͠ •B+treeͱϒϩοΫΩϟογϡͱ͍͏σʔλߏΛ͍ɺ •WALͱB+treeͰӬଓԽΛ͠ʢϨϓϦέʔγϣϯ͠ͳ͍ʣɺ •MVCCͳͲͰฒߦੑ੍ޚΛߦ͏σʔλϕʔεཧγεςϜ
NoSQL? •Not Only? •ݴ༿ͱҟͳΔɺ2௨Γͷ࣮ଶ •A) σʔλϞσϧɺΠϯλʔϑΣʔεͱͯ͠SQLΛͬͯ ͍ͳ͍ •B) طଘͷτϥϯβΫγϣϯॲཧٕज़ͰͰ͖ͳ͔ͬͨ͜ ͱΛ࣮ݱ͢ΔͨΊʹɺผٕज़Λ࠾༻ͨ͠
SQLͰͳ͍ʁ •ϦϨʔγϣφϧϞσϧͰͳ͍ԿΒ͔ͷσʔλϞσϧ •σʔλදݱΫΤϦݴޠʹSQLΛΘͳ͍ •υΩϡϝϯτDB: “Semi-structured database” •Redis •KVS (Key-Value Store):
ฆΒΘ͍͠
Document DB •ͱͱͷࢥ: •͋ΒΏΔλΠϓͷυΩϡϝϯτΛอଘͯ͠ΫΤϦ Ͱ͖ΔΑ͏ʹ͠Α͏ •JSON, XML, PDF, etc… •ݱ࣮:
݁ہ… •KVS ʹ JSON + ΠϯσοΫε + ࢄMapReduce
ACIDͰͳ͍ʁ
ACID •Atomicity •ߋ৽ͷ్தঢ়ଶ͕ݟ͑ͳ͍͜ͱ •Isolation •ଞͷਓ͕ߋ৽͍ͯ͠Δͷ͕ݟ͑ͳ͍͜ͱ •Key-Value StoreͳΒɺ୯ҰͷΤϯτϦΛϩοΫͯ͠ߋ৽͢Δͩ ͚ͳͷͰAtomicͩ͠Isolated!! ʢϗϯτʁʣ
ACID •RDBͩͱ •ϦϨʔγϣϯಉ࢜ͷσʔλ͕߹͍ͯ͠Δ͜ͱ •ࢄτϥϯβΫγϣϯͯ͠σʔλ͕ෆ߹͠ͳ͍͜ͱ •ނোͯ͠߹ͨ͠ঢ়ଶͰϦΧόϦͰ͖Δ͜ͱ •NoSQLͩͱ •ϨϓϦέʔγϣϯͯ͠σʔλ͕ෆ߹͠ͳ͍͜ͱ •Key-Value StoreͳΒ…
ACID •RDBͩͱ •ӬଓԽσΟεΫʹॻ͍ͨΒऴΘΓ •σΟεΫյΕͨΒΒͶ •NoSQLͩͱ •σΟεΫյΕͯιϑτΣΞͰԿͱ͔͢Δ •ࣗͰϨϓϦέʔγϣϯΔʂ
εέʔϧΞτʁ •σʔλͷۭؒΛԿΒ͔ͷϧʔϧʹଇׂͬͯ͢Δ •ׂͨ͠σʔλΛࢄͯ͠ཧ͢Δ •ϊʔυΛ૿͢ͱॲཧೳྗ༰ྔ͕૿͑Δʢʁʣ
εέʔϧΞτਤղ σʔλۭؒ ׂۭؒ
B+Tree •ΩʔΠϯσοΫε͔Β O(log N) ҎԼͷίετͰ σʔλΛݟ͚ͭΔͨΊͷσʔλߏ •εέʔϧΞτ͢Δͱ… •͍͔ͭ͘ิʢସʣٕज़͕͋Δ •Consistent Hashing
•γϟʔσΟϯά (Range Partitioning) •֊γϟʔσΟϯά
εέʔϧΞτͱނোੑ •Q. 1ͷϊʔυͷނো֬Λ p ͱ͢Δͱɺ n ͷΫϥελ͕શͯ ਖ਼ৗಈ࡞͍ͯ͠Δ֬ʁ 1. 1
- p^n 2. p^n 3. (1 - p)^n •εέʔϧ͕େ͖͍ͱɺͲ͔͕͜΄΅ඞͣյΕ͍ͯΔঢ়ଶʹͳΔ •෦ނো͕ى͖͍ͯͯશମ͕ਖ਼͘͠ಈ࡞͢Δઃܭ͕ඞཁ •ϨϓϦέʔγϣϯʹΑΔࣗಈతͳϑΣΠϧΦʔόʔͳͲ͕ඞཁ
ਖ਼ৗಈ࡞ͷ֬ n \ p 0.1 0.01 0.001 1 0.9 0.99
0.999 10 0.348678440 0.904382075 0.990044880 100 0.000026561 0.366032341 0.904792147 1000 0 0.000043171 0.367695424 ※༗ޮࣈ…
εέʔϧΞτਤղ 2 σʔλۭؒ ෳ
ӬଓԽͱ •ܗ͋Δͷ͍͔ͭյΕΔ •ॾߦແৗʢେൠᔷᒒܦʣ •2ͭҎ্ͷίϐʔΛ͓࣋ͬͯ͘Ҏ֎ʹɺ σʔλΛӬٱʹอଘ͢Δํ๏ͳ͍ •ෳͷͳ͍σʔλϕʔεͳ͍
ෳඞͣ࡞ΒΕΔ •LANͷ͜͏Ͱ •SANͷ͜͏Ͱ •ւͷ͜͏Ͱ •ނো୯Ґ͕ඞ͔ͣΕ ͍ͯΔ (C) Evan Amos
ނোͯ͠ಈ࡞ܧଓ͢Δෳ •Ͳ͏͍͏ނোϞσϧΛલఏʹͯ͠Ϩϓ ϦέʔγϣϯΛΜ͔͕ͩॏཁ •Fail-stopΛલఏʹ͍͚ͯ͠ͳ͍ •ʮյΕ͔͚ͷRadioʯ •͍ΘΏΔαΠϨϯτނো •ωοτϫʔΫͷஅɺॠஅ •Disk Hiccup (C)
Evan Amos
ωοτϫʔΫͷஅ •அͨ͠ΒɺͲͪΒ͕ਖ਼͠ ͍͔ܾΊͳ͚Ε͍͚ͳ͍ •ϚχϡΞϧͰհೖ͢Εܾ ΊΒΕΔʢ͔͠Εͳ͍ʣ •ࣗಈԽ͢Δʹɺωοτϫʔ Ϋ͕ΕͯσʔλΛ߹ ͤ͞Δෳٕज़͕ඞཁ ? ?
(C) Evan Amos
ෳͷٕज़ ෳͷλΠϓ ނোͳͲͷલఏ Master-slave ಉظ ωοτϫʔΫ͕ނোͨ͠Βࢭ·Δ Master-slave ඇಉظ ωοτϫʔΫ͕ނোͨ͠Β σʔλ͕ෆ߹͢Δ͔
Consensus (Strong Consistency) ωοτϫʔΫ͕ނোͨ͠ΒҰ෦ಈ࡞ Eventual Consistency ωοτϫʔΫ͕ނোͯ͠શಈ࡞
ෳͰͳ͍σʔλͷ߹ੑ •εέʔϧΞτ͢Δͱɺผϊʔυ্ͷ ผͷσʔλΛ߹ͨ͠ঢ়ଶͰߋ৽͠ͳ ͚ΕͳΒͳ͍ •ࢄͨ͠ΠϯσοΫεͷߋ৽ •֎෦Ωʔͷߋ৽ •τϦΨʔͷॲཧ
εέʔϧΞτਤղ 3 ςʔϒϧ ΠϯσοΫε or FKey or else
ෳͰͳ͍σʔλͷ߹ੑ อো •2PC (or ࢄϩοΫ) •ϩοΫΛ࣋ͬͨ··ϊʔυ͕ނোͨ͠ͱ͖ͷѻ͍ •Cluster-wideͰҰ؏ͯ͠୯ௐ૿Ճ͢ΔԿΒ͔ͷΛੜ͢Ε ɺTSOMVCCΛ࣮Ͱ͖Δ •λΠϜελϯϓ …
࣌ܭͷಉظΛอো͢Δํ๏͕ࣗ໌Ͱͳ͍ •IDΛൃߦ͢ΔϚελʔϊʔυ … SPoF •͜͜·ͰͪΌΜͱ͍ͬͯΔNoSQL΄ͱΜͲͳ͍
NoSQLͷऴΘΓ •RDBMSͰղ͚ͳ͔͕͍͔ͬͨͭ͘ղ͚ͨͷͰʮͬͺΓSQL͕΄͍͠ʯ ʮ׳Εٕͨज़ऀ͕ଟ͍ͷͰʯ •ϦϨʔγϣφϧϞσϧʹଇ͍ͯ͠ͳ͍σʔλͰSQLͰΫΤϦΛॻ͚ͯ͠·͏ •͍͔ͭ͘ͷNoSQLɺτϥϯβΫγϣϯཧΛͦͦ͜͜ʹ SQL(-like ͳ) ΠϯλʔϑΣʔεΛఏڙͭͭ͋͠Δ •CQL, N1QL,
etc.. •OLAP͚ͷMPPΤϯδϯSQL͕ඪ४ •Impala, Drill, PrestoDB, Calcite
2ͭͷٕज़ •ΫΤϦॲཧ •RDBMSͰSQL •RDBMSͰͳͯ͘SQL •τϥϯβΫγϣϯॲཧ •ACIDΛ࣮ݱ͍ͯ͠ΔRDBMS •ࢄ͍ͯͯ͠ACIDΛࢦ͍ͯ͠Δ
Summary •ʢੲʣNoSQL ͱɺطଘͷσʔλϕʔεٕज़Λ1͔Βݟͳ ͓ͯ͠ɺRDBMSͰͰ͖ͳ͔ͬͨ͜ͱΛୡ͠Α͏ͱͨ͠Ұ ࿈ͷࢼΈ •ϦϨʔγϣφϧϞσϧɺB+treeɺϨϓϦέʔγϣϯ •ʢࠓʣ͏Կ͕ͳΜ͔͔ͩΒͳ͍͘Β͍ଟ༷Խ •ٕज़తͳ؍ʢͷྨʣ •εέʔϧΞτɺނোੑɺ߹ੑʢɺ͋ΔΑ