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
330
Apache Ozone behind Simulation and AI Industries
kuenishi
0
310
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
680
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
AWS re:Invent 2024 recap
hkoketsu
0
300
ハイテク休憩
sat
PRO
2
180
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
200
AWS re:Invent 2024 Recap in ZOZO - Serverless で好きなものをしゃべってみた
chongmyungpark
0
290
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
130
【令和最新版】ロボットシミュレータ Genesis x ROS 2で始める快適AIロボット開発
hakuturu583
1
540
生成AIのガバナンスの全体像と現実解
fnifni
1
230
メンタル面でもつよつよエンジニアになる/登壇資料(井田 献一朗)
hacobu
0
140
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
590
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
290
Storage Browser for Amazon S3
miu_crescent
1
300
.NET 9 のパフォーマンス改善
nenonaninu
0
1.6k
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
BBQ
matthewcrist
85
9.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
920
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Making Projects Easy
brettharned
116
6k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
We Have a Design System, Now What?
morganepeng
51
7.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
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ɺϨϓϦέʔγϣϯ •ʢࠓʣ͏Կ͕ͳΜ͔͔ͩΒͳ͍͘Β͍ଟ༷Խ •ٕज़తͳ؍ʢͷྨʣ •εέʔϧΞτɺނোੑɺ߹ੑʢɺ͋ΔΑ