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
可能な限りRDB脳のままCloud_Firestoreを使ってみる.pdf
Search
TsukasaSekiguchi
June 01, 2019
Technology
0
640
可能な限りRDB脳のままCloud_Firestoreを使ってみる.pdf
https://gunmaweb.connpass.com/event/127593/
のLTスライドです!
TsukasaSekiguchi
June 01, 2019
Tweet
Share
More Decks by TsukasaSekiguchi
See All by TsukasaSekiguchi
v0とCursorで爆速開発🚀
tsukasagr
0
120
Prismaを1年くらい使ってみたのでちょっと語る
tsukasagr
0
150
playwrightのVSCode拡張が便利すぎて、もはやE2E書けないとか言い訳できないレベルだった
tsukasagr
0
160
AWS_Copilotではじめる簡単コンテナ運用.pdf
tsukasagr
0
350
SupabaseにBaaS拡大の未来を感じた
tsukasagr
0
230
超ざっくりFirebase vs Amplify
tsukasagr
0
290
NestJSがいい感じだった
tsukasagr
0
290
Slack Apps × BoltでToDoアプリ作ってみたって話のはずだったけど、周辺技術で良さそうなやつがあったのでそのへんも共有する話
tsukasagr
0
430
俺のMac
tsukasagr
0
300
Other Decks in Technology
See All in Technology
AWS環境におけるランサムウェア攻撃対策の設計
nrinetcom
PRO
0
170
サイボウズフロントエンドエキスパートチームについて / FrontendExpert Team
cybozuinsideout
PRO
5
38k
[JAWS-UG新潟#20] re:Invent2024 -CloudOperationsアップデートについて-
shintaro_fukatsu
0
120
エンジニアカフェ忘年会2024「今年やらかしてしまったこと!」
keropiyo
0
100
Working as a Server-side Engineer at LY Corporation
lycorp_recruit_jp
0
370
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
18
5.5k
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
320
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
120
型情報を用いたLintでコード品質を向上させる
sansantech
PRO
2
140
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
1
270
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
260
Featured
See All Featured
Building Your Own Lightsaber
phodgson
103
6.1k
Optimizing for Happiness
mojombo
376
70k
Site-Speed That Sticks
csswizardry
2
190
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
4 Signs Your Business is Dying
shpigford
182
21k
Building Adaptive Systems
keathley
38
2.3k
Typedesign – Prime Four
hannesfritz
40
2.4k
Transcript
ՄೳͳݶΓRDBͷ·· Cloud FireStoreΛ ͬͯΈΔ 2019/06/01 Gunma.web #35 ؔޱ ࢘
໊લ: ؔޱ࢘ SNS: GitHub: TsukasaGR Twitter: TsukasaGr NewsPicks: ؔޱ࢘ ࠲ӈͷ
ࣗͷͨΊʹɺଞਓʹਚ͘͢ ࣄ: αϥϦʔϚϯ: SIerͰ৽نࣄۀ(toC͚ͷWebαʔϏε)։ൃ ϑϦʔϥϯε: ελʔτΞοϓͷWebΤϯδχΞ ࠷ۙ৮ͬͯΔͷ: PHP(Laravel)ɺJavascript/Typescript(Vue.js/Nuxt.js)ɺGraphQLɺDockerɺAWSɺFirebase ࣗݾհ
What is Cloud Firestore? • Firebase͕ఏڙ͍ͯ͠ΔΫϥυσʔλϕʔε • ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ • Φʔτεέʔϧͯ͘͠ΕΔ
• ϦΞϧλΠϜಉظ͕ඵͰ࣮ݱग़དྷΔ • NoSQLͳͷͰRDBͱউख͕͍ͣͿΜҧ͏
• Firebase͕ఏڙ͍ͯ͠ΔΫϥυσʔλϕʔε • ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ • Φʔτεέʔϧͯ͘͠ΕΔ • ϦΞϧλΠϜಉظ͕ඵͰ࣮ݱग़དྷΔ • NoSQLͳͷͰRDBͱউख͕͍ͣͿΜҧ͏
ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41"
ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41" App Server͕ෆཁʂ
αʔόʔཧ͕ෆཁ • AppServerΛ༻ҙ͠ͳͯ͘ྑ͍ • όοΫΤϯυͷॲཧΛҰॻ͔ͣʹϑϩϯτΤϯ υͷΈͰ݁ग़དྷΔ
• Firebase͕ఏڙ͍ͯ͠ΔΫϥυσʔλϕʔε • ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ • Φʔτεέʔϧͯ͘͠ΕΔ • ϦΞϧλΠϜಉظ͕ඵͰ࣮ݱग़དྷΔ • NoSQLͳͷͰRDBͱউख͕͍ͣͿΜҧ͏
αʔόʔཧ͕ෆཁ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41"
αʔόʔཧ͕ෆཁ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41" DB Server͕ෆཁʂ
αʔόʔཧ͕ෆཁ • DBServerΛ༻ҙ͠ͳͯ͘ྑ͍ • Φʔτεέʔϧͯ͘͠ΕΔͷͰߴෛՙʹΑΔμ ϯΛؾʹ͠ͳͯ͘ྑ͍
• Firebase͕ఏڙ͍ͯ͠ΔΫϥυσʔλϕʔε • ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ • Φʔτεέʔϧͯ͘͠ΕΔ • ϦΞϧλΠϜಉظ͕ඵͰ࣮ݱग़དྷΔ • NoSQLͳͷͰRDBͱউख͕͍ͣͿΜҧ͏
ϦΞϧλΠϜಉظָ͕ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41"
ϦΞϧλΠϜಉظָ͕ Ұൠతͳ8FC"QQ 41" $MPVE'JSFTUPSFΛͬͨ 8FC"QQ 41" ΈԽָ͕ʂ
ϦΞϧλΠϜಉظָ͕ • Web Socket ServerΛ༻ҙ͠ͳͯ͘ྑ͍ • ߏஙίετθϩ
• Firebase͕ఏڙ͍ͯ͠ΔΫϥυσʔλϕʔε • ϑϩϯτΤϯυ͔Βૢ࡞ग़དྷΔ • Φʔτεέʔϧͯ͘͠ΕΔ • ϦΞϧλΠϜಉظ͕ඵͰ࣮ݱग़དྷΔ • NoSQLͳͷͰRDBͱউख͕͍ͣͿΜҧ͏
RDBͱউख͕͍ͣͿΜҧ͏ Ұൠతͳ42- $MPVE'JSFTUPSFΛͬͨ ΫΤϦ
RDBͱউख͕͍ͣͿΜҧ͏ Ұൠతͳ42- $MPVE'JSFTUPSFΛͬͨ ΫΤϦ ϦϨʔγϣϯઌͷ݅Ͱ ͍͘ΒͰࢦఆग़དྷΔ ϦϨʔγϣϯઌͷ͕͔݅ͳΓݶఆతͰɺ ͦͦϦϨʔγϣϯ͢Δͷͪΐ͍໘
ͬ͘͟ΓRDB NoSQL 3%# 'JSFTUPSF /P42- • ݫີ͞ʹΑΔ҆৺ײ • ͔Ώ͍ͱ͜Ζʹख͕ಧ͘ •
େنσʔλʹ͑͏Δͷ͕ͭΒ ͨΜ • ܰշ͞ɺॊೈ͞ʹΑΔߴύϑΥʔ Ϛϯε • γϯϓϧ͕ނʹ͔Ώ͍ͱ͜Ζࣗ ͰؤுΔ
ͬ͘͟ΓRDB NoSQL 3%# 'JSFTUPSF /P42- • ݫີ͞ʹΑΔ҆৺ײ • ͔Ώ͍ͱ͜Ζʹख͕ಧ͘ •
େنσʔλʹ͑͏Δͷ͕ͭΒ ͨΜ • ܰշ͞ɺॊೈ͞ʹΑΔߴύϑΥʔ Ϛϯε • γϯϓϧ͕ނʹ͔Ώ͍ͱ͜Ζࣗ ͰؤுΔ ͕ඞཁ
1: σʔλͷԽ 3%# 'JSFTUPSF /P42-
1: σʔλͷԽ 3%# 'JSFTUPSF /P42- ͋͑ͯඇਖ਼نԽͯ͠ ࣋ͨͤΔ
2: Client Side Join 3%# 'JSFTUPSF /P42-
2: Client Side Join 3%# 'JSFTUPSF /P42- ݩσʔλऔಘޙɺϦϨʔγϣϯઌͷσʔλΛऔಘ
Client Side Join͢ΕRDBͷ··ͰͦΕͳΓʹ͑Δ • σʔλΛԽͤ͞ΔͷRDB͔Β͢Δͱ࠷ॳڋ ൱Ԡ͕ग़ͯ͠·͏ • Client Side JoinͳΒDBΛਖ਼نԽͨ͠··Ͱߦ͚Δ
• (ݺͼग़͢ଆN+1Λঝͷ͏͑ͰΰϦΰϦΔඞཁ͋Δ͕)
ͦΕͰͬͺΓਏΈ͋Δ • ͑Δൺֱԋࢉࢠ <, <=, ==, >, >= ͷΈ •
OR͕͑ͳ͍ • In۟͑ͳ͍ • Like͑ͳ͍
ෳࡶͳݕࡧΛ͍ͨ͠߹ Ҿ༻ɿhttps://firebase.google.com/docs/firestore/solutions/search
ෳࡶͳݕࡧΛ͍ͨ͠߹ Ҿ༻ɿhttps://firebase.google.com/docs/firestore/solutions/search ෳࡶͳ݅ΛFirestoreͰΓ͘Γ͢Δͷݱ࣮తͰͳ͍
ෳࡶͳݕࡧΛ͍ͨ͠߹ Ҿ༻ɿhttps://firebase.google.com/docs/firestore/solutions/search ෳࡶͳ݅ΛFirestoreͰΓ͘Γ͢Δͷݱ࣮తͰͳ͍ શจݕࡧΛ͏
શจݕࡧαʔϏεΛ͏ Firestoreొ࣌ʹAlgoliaʹσʔλΛొ͓͚ͯ͠ɺ
શจݕࡧαʔϏεΛ͏ Firestoreొ࣌ʹAlgoliaʹσʔλΛొ͓͚ͯ͠ɺ ॊೈɺ͔ͭߴʹσʔλऔಘग़དྷΔ
શจݕࡧαʔϏεΛ͏ Firestoreొ࣌ʹAlgoliaʹσʔλΛొ͓͚ͯ͠ɺ ॊೈɺ͔ͭߴʹσʔλऔಘग़དྷΔ શจݕࡧ × Client Side Join = DBΛਖ਼نԽͨ͠··FirestoreΛ͑Δʂ
ͨͩ͠ɺ༻๏༻ྔΛकͬͯਖ਼ͬͨ͘͠΄͏͕ྑ͍ • ͦͦRDBͱNoSQLͰత͕ҧ͏ͷͰ͏໘ ͕ҟͳΔ • ͲͪΒ͔͚ͩͰͳ͘ɺ྆ํΛॴʹΑ͍ͬͯ ͚Δͷ͕εϚʔτ(ͱࢥΘΕΔ)
Ͱɺͳͥ͜ͷLTΛͨ͠ͷ͔ • ʮͱΓ͋͑ͣࠔͬͨΒϩΩιχϯʯతͳײ͡Ͱ༻๏༻ ྔΛଟগແࢹͯ͠ͰָʹͳΓ͍͕ͨ࣌͋Δͣ
ϩΩιχϯͷ͍࣌ • SPA(※) • DBαʔόʔΛཧͨ͘͠ͳ͍ • ϦΞϧλΠϜσʔλಉظΛ͍͍ͨ (※)AlgoliaΛར༻͢Δ߹όοΫΤϯυ͕ඞཁ͕ͩɺCloudFunctionsΛ͏͜ͱͰAppServerෆཁʹͳΔ
ϩΩιχϯͷ͍࣌ • SPA • DBαʔόʔΛཧͨ͘͠ͳ͍ • ϦΞϧλΠϜσʔλಉظΛ͍͍ͨ DBΞΫηεҎ֎ ϑϩϯτͷΈ Ͱ݁͢Δ
(※)AlgoliaΛར༻͢Δ߹όοΫΤϯυ͕ඞཁ͕ͩɺCloudFunctionsΛ͏͜ͱͰAppServerෆཁʹͳΔ
ϩΩιχϯͷ͍࣌ • SPA • DBαʔόʔΛཧͨ͘͠ͳ͍ • ϦΞϧλΠϜσʔλಉظΛ͍͍ͨ εέʔϧ͢Δ͔͠Εͳ͍͚Ͳɺ͠ͳ͍͔ ͠Εͳ͍ɺͨͩϦιʔεݶΒΕ͍ͯ ΔɺΈ͍ͨͳ࣌ʹ࠷ॳ͔ΒΦʔτεέʔϧ
ͷΈԽͳΜͯͬͯΒΕͳ͍ DBΞΫηεҎ֎ ϑϩϯτͷΈ Ͱ݁͢Δ (※)AlgoliaΛར༻͢Δ߹όοΫΤϯυ͕ඞཁ͕ͩɺCloudFunctionsΛ͏͜ͱͰAppServerෆཁʹͳΔ
ϩΩιχϯͷ͍࣌ • SPA • DBαʔόʔΛཧͨ͘͠ͳ͍ • ϦΞϧλΠϜσʔλಉظΛ͍͍ͨ εέʔϧ͢Δ͔͠Εͳ͍͚Ͳɺ͠ͳ͍͔ ͠Εͳ͍ɺͨͩϦιʔεݶΒΕ͍ͯ ΔɺΈ͍ͨͳ࣌ʹ࠷ॳ͔ΒΦʔτεέʔϧ
ͷΈԽͳΜͯͬͯΒΕͳ͍ ௨όοξνϟοτػೳ͚ͩαΫοͱϦΞϧλΠϜಉظ͍͚ͨ͠Ͳ WebSocketཧղ͖͠Εͯͳ͍࣌ؒ͠ͳ͍ DBΞΫηεҎ֎ ϑϩϯτͷΈ Ͱ݁͢Δ (※)AlgoliaΛར༻͢Δ߹όοΫΤϯυ͕ඞཁ͕ͩɺCloudFunctionsΛ͏͜ͱͰAppServerෆཁʹͳΔ
ϩΩιχϯͷ͍࣌ • SPA • DBαʔόʔΛཧͨ͘͠ͳ͍ • ϦΞϧλΠϜσʔλಉظΛ͍͍ͨ εέʔϧ͢Δ͔͠Εͳ͍͚Ͳɺ͠ͳ͍͔ ͠Εͳ͍ɺͨͩϦιʔεݶΒΕ͍ͯ ΔɺΈ͍ͨͳ࣌ʹ࠷ॳ͔ΒΦʔτεέʔϧ
ͷΈԽͳΜͯͬͯΒΕͳ͍ ௨όοξνϟοτػೳ͚ͩαΫοͱϦΞϧλΠϜಉظ͍͚ͨ͠Ͳ WebSocketཧղ͖͠Εͯͳ͍࣌ؒ͠ͳ͍ DBΛਖ਼نԽͨ͠··FirestoreΛ͏͕͘Δ ͔͠Εͳ͍(͠ɺདྷͳ͍͔͠Εͳ͍) DBΞΫηεҎ֎ ϑϩϯτͷΈ Ͱ݁͢Δ (※)AlgoliaΛར༻͢Δ߹όοΫΤϯυ͕ඞཁ͕ͩɺCloudFunctionsΛ͏͜ͱͰAppServerෆཁʹͳΔ
͍͞͝ʹ
• ࠓ͍ͭͬͯ͘ΔϓϩμΫτͰࢼ͍ͯ͠Δ͕ɺ·ͩྑ ͠ѱ͠ΛஅͰ͖͍ͯͳ͍ • RDB͕࿀͘͠ͳΔ࣌ਖ਼݁ߏ͋Δ • ͦΕͰݸਓతʹ͏ཧ༝ҎԼ • DB Serverෆཁ
>>> App Serverෆཁ >>> ϦΞ ϧλΠϜσʔλಉظ • ແྉ͔Β࢝ΊΒΕΔͷͰɺͥͻօ͞Μ৮ͬͯΈͯ ͍͔͕Ͱ͠ΐ͏͔ʂ