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
750
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
500
スマートなcronを考案した / lazy cron
yatima
1
5.5k
Firebaseざっくり / GDG Tokyo New Year Seminar 2018
yatima
0
920
Firestoreで負荷試験 (Loadroid by Rocro) / Firebase.yebisu #1
yatima
1
740
大半のウェブサービス/アプリは,Firebaseなら簡単で安いですよ
yatima
2
3.3k
Realtime Databaseのベストプラクティスっぽいやつ
yatima
0
680
Other Decks in Technology
See All in Technology
改めて学ぶ Trait の使い方 / phpcon odawara 2025
meihei3
1
140
自分の軸足を見つけろ
tsuemura
1
170
Lightdashの利活用状況 ー導入から2年経った現在地_20250409
hirokiigeta
2
230
ペアプログラミングにQAが加わった!職能を超えたモブプログラミングの事例と学び
tonionagauzzi
1
160
TopAppBar Composableをカスタムする
hunachi
0
170
「家族アルバム みてね」を支えるS3ライフサイクル戦略
fanglang
4
620
こんなデータマートは嫌だ。どんな? / waiwai-data-meetup-202504
shuntak
3
810
製造業の会計システムをDDDで開発した話
caddi_eng
3
1.1k
Startups On Rails 2025 @ Tropical on Rails
irinanazarova
0
200
3/26 クラウド食堂LT #2 GenU案件を通して学んだ教訓 登壇資料
ymae
1
240
Zabbixチョットデキルとは!?
kujiraitakahiro
0
130
Cline、めっちゃ便利、お金が飛ぶ💸
iwamot
21
19k
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
336
57k
Facilitating Awesome Meetings
lara
53
6.3k
GraphQLの誤解/rethinking-graphql
sonatard
70
10k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
17
1.1k
Rebuilding a faster, lazier Slack
samanthasiow
80
8.9k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
118
51k
Building a Modern Day E-commerce SEO Strategy
aleyda
39
7.2k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.4k
Automating Front-end Workflow
addyosmani
1369
200k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
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