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
100
Prismaを1年くらい使ってみたのでちょっと語る
tsukasagr
0
140
playwrightのVSCode拡張が便利すぎて、もはやE2E書けないとか言い訳できないレベルだった
tsukasagr
0
150
AWS_Copilotではじめる簡単コンテナ運用.pdf
tsukasagr
0
340
SupabaseにBaaS拡大の未来を感じた
tsukasagr
0
220
超ざっくりFirebase vs Amplify
tsukasagr
0
290
NestJSがいい感じだった
tsukasagr
0
280
Slack Apps × BoltでToDoアプリ作ってみたって話のはずだったけど、周辺技術で良さそうなやつがあったのでそのへんも共有する話
tsukasagr
0
430
俺のMac
tsukasagr
0
290
Other Decks in Technology
See All in Technology
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
180
FlutterアプリにおけるSLI/SLOを用いたユーザー体験の可視化と計測基盤構築
ostk0069
0
120
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
38
13k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Taming you application's environments
salaboy
0
200
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
110
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
10
1.4k
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
1.4k
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
220
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Designing Experiences People Love
moore
138
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How STYLIGHT went responsive
nonsquared
95
5.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Fireside Chat
paigeccino
34
3k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
How to Ace a Technical Interview
jacobian
276
23k
Speed Design
sergeychernyshev
25
620
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ෆཁ >>> ϦΞ ϧλΠϜσʔλಉظ • ແྉ͔Β࢝ΊΒΕΔͷͰɺͥͻօ͞Μ৮ͬͯΈͯ ͍͔͕Ͱ͠ΐ͏͔ʂ