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
810
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
330
Apache Ozone behind Simulation and AI Industries
kuenishi
0
290
Distributed Deep Learning with Chainer and Hadoop
kuenishi
3
1.1k
A Few Ways to Accelerate Deep Learning
kuenishi
0
990
Introducing Retz
kuenishi
5
1.1k
Introducing Retz and how to develop practical frameworks
kuenishi
3
670
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
エンジニア人生の拡張性を高める 「探索型キャリア設計」の提案
tenshoku_draft
1
110
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
Taming you application's environments
salaboy
0
180
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
270
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
540
Platform Engineering for Software Developers and Architects
syntasso
1
510
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
560
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
220
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
460
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
490
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
49
11k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Optimizing for Happiness
mojombo
376
70k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
It's Worth the Effort
3n
183
27k
Statistics for Hackers
jakevdp
796
220k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Done Done
chrislema
181
16k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Why Our Code Smells
bkeepers
PRO
334
57k
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ɺϨϓϦέʔγϣϯ •ʢࠓʣ͏Կ͕ͳΜ͔͔ͩΒͳ͍͘Β͍ଟ༷Խ •ٕज़తͳ؍ʢͷྨʣ •εέʔϧΞτɺނোੑɺ߹ੑʢɺ͋ΔΑ