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
Modeling DB @ Cloud Firestore
Search
Yatima-Kagurazaka
December 16, 2017
Technology
2
730
Modeling DB @ Cloud Firestore
push ID: auto ID in Realtime Database
Yatima-Kagurazaka
December 16, 2017
Tweet
Share
More Decks by Yatima-Kagurazaka
See All by Yatima-Kagurazaka
ChromeOS, Firebase - Google I\O ‘18
yatima
0
480
スマートなcronを考案した / lazy cron
yatima
1
5.4k
Firebaseざっくり / GDG Tokyo New Year Seminar 2018
yatima
0
910
Firestoreで負荷試験 (Loadroid by Rocro) / Firebase.yebisu #1
yatima
1
690
大半のウェブサービス/アプリは,Firebaseなら簡単で安いですよ
yatima
2
3.2k
Realtime Databaseのベストプラクティスっぽいやつ
yatima
0
680
Other Decks in Technology
See All in Technology
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Security-JAWS【第35回】勉強会クラウドにおけるマルウェアやコンテンツ改ざんへの対策
4su_para
0
170
B2B SaaS × AI機能開発 〜テナント分離のパターン解説〜 / B2B SaaS x AI function development - Explanation of tenant separation pattern
oztick139
2
220
Evangelismo técnico: ¿qué, cómo y por qué?
trishagee
0
350
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
いざ、BSC討伐の旅
nikinusu
2
780
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
290
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
580
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Why does continuous profiling matter to developers? #appdevelopercon
salaboy
0
180
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
YesSQL, Process and Tooling at Scale
rocio
169
14k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Code Review Best Practice
trishagee
64
17k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
How to Ace a Technical Interview
jacobian
276
23k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Keith and Marios Guide to Fast Websites
keithpitt
409
22k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Speed Design
sergeychernyshev
24
610
Transcript
Modeling DB @ Cloud Firestore Yatima Kagurazaka ://yati.ma
yati.ma/qi Yatima Kagurazaka Minkore CTO MENSAn Physician I like tech,
design, music, etc My PC: Pixelbook(+ VSCode on Kali Linux)
yati.ma/qi Agenda • What is Cloud Firestore • Structure •
Yatima Model
What is Cloud Firestore
So easy but Equal to prod. use and Inexpensive
yati.ma/qi So easy Realtime Offline mode Direct connect to clients
(like Realtime Database)
yati.ma/qi Equal to prod. use Almost no downtime Super scalability
Multi region Strong Consistency Some query support
yati.ma/qi Almost no downtime
“ yati.ma/qi Super scalability you'll get the same performance fetching
1 result from a set of 100, or 100,000,000.
Structure
Collection, Doc, Field
Collection, Doc, Field
A doc is minimum unit at communication
yati.ma/qi A doc is minimum unit Read Write Rule Update
limit: 1/sec Subcollection depth: ≦ 100
All queries are shallow
Query is available only in a collection, so far
For making full use, change a way of thinking
Yatima Model
UniFeed: Supereasy timeline system
None
yati.ma/qi UniFeed: Usage Just query at viewer self ID!
yati.ma/qi UniFeed: Limit Indexes in a document: ≦ 20,000 But
we can batch() (≦ 500)
yati.ma/qi Multi UniFeed Follower: ≦ 10,000,000 (20,000 * 500) ...Actually,
not everyone follow one Probably up to approx. 1M follower in rough estimate
yati.ma/qi Level 2 multi UniFeed Add batch() at Cloud Functions,
more scalable Follower: ≦ 5,000,000,000 (20,000 * 500 * 500) and you can go any level! your bank balance vs Google’s capacity
Twixxer should use it immediately :-P
But wait, how about doc size?
yati.ma/qi UniFeed: Doc size w/ auth.uid: < approx. 600kb (20,000
* 30 chars) w/ pushid: < approx. 300kb (20,000 * 15 chars) ...Actually, not everyone bla bla so at most 30kb, usually 300 or less (realistic!)
Firebase as a Cache (Componentized DB, Virtual DB)
yati.ma/qi General: Write
yati.ma/qi General: Read
yati.ma/qi FaaC: Write Virtual DB
yati.ma/qi FaaC: Read
yati.ma/qi FaaC: Pros Componentized DB Flux-like data flow Explicit communications
Flexibility of DB Faster view
yati.ma/qi Flux architecture
yati.ma/qi General: Data flow
yati.ma/qi FaaC: Flux-like data flow Virtual DB
yati.ma/qi General: Implicit comm. Who are you?
yati.ma/qi FaaC: Explicit comm. I know! Same component
yati.ma/qi FaaC: Cons Need to edit DB/rule occasionally (Build tool
overcome it) Fetch per component
yati.ma/qi FaaC: Background Lower cost to edit DB Component-Based Architecture
Denormalize Trend of static contents CDN
A doc is minimum unit! English is difficult for me!
Fin. ヾ(╹◡╹*)ノ゛ Throw your masakari axe at me! ://yati.ma