Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Modeling DB @ Cloud Firestore
Yatima-Kagurazaka
December 16, 2017
Technology
2
540
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
350
スマートなcronを考案した / lazy cron
yatima
1
4.9k
Firebaseざっくり / GDG Tokyo New Year Seminar 2018
yatima
0
870
Firestoreで負荷試験 (Loadroid by Rocro) / Firebase.yebisu #1
yatima
1
420
大半のウェブサービス/アプリは,Firebaseなら簡単で安いですよ
yatima
2
3k
Realtime Databaseのベストプラクティスっぽいやつ
yatima
0
600
Other Decks in Technology
See All in Technology
IoTLT88-NTKanazawa-laundry-dry
yukima0707
0
230
2024卒_freee_エンジニア職(ポテンシャル採用)_説明資料
freee
0
250
JUnit5.7, 5.8の新機能紹介 #jjug_ccc #jjug_ccc_b / junit 5.7, 5.8 new features
kyonmm
PRO
2
420
RDRA + JavaによるレジャーSaaSプロダクトの要件定義と実装のシームレスな接続
jjebejj
PRO
3
700
UIKitのアップデート #WWDC22
akatsuki174
4
330
ソフトウェアライセンス 2022 / Software License 2022
cybozuinsideout
PRO
1
1.1k
Custom GitHub Actions by Java
kazamori
0
290
Introduction To Technical Writing
olawanle_joel
0
100
Lessons Learned from Scaling Infrastructure as Code
joatmon08
0
800
インフラのCI/CDはGitHub Actionsに任せた
mihyon
0
110
MRTK3 - DataBinding and Theming 入門
futo23
0
190
Retca Cloud
bau
0
520
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
238
11k
Product Roadmaps are Hard
iamctodd
34
6.5k
Unsuck your backbone
ammeep
659
55k
Art Directing for the Web. Five minutes with CSS Template Areas
malarkey
196
9.4k
Mobile First: as difficult as doing things right
swwweet
213
7.5k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
29
4.3k
Adopting Sorbet at Scale
ufuk
63
7.6k
Keith and Marios Guide to Fast Websites
keithpitt
404
21k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_i
23
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
181
15k
Facilitating Awesome Meetings
lara
29
4k
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