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
社内アプリで Cloudflare D1を プロダクト運用してみた体験談 @Cloudflar...
Search
Haochen Kotoi-Xie
April 15, 2024
Programming
0
200
社内アプリで Cloudflare D1を プロダクト運用してみた体験談 @Cloudflare Meetup Nagoya
Haochen Kotoi-Xie
April 15, 2024
Tweet
Share
More Decks by Haochen Kotoi-Xie
See All by Haochen Kotoi-Xie
社内アプリで Cloudflare D1を プロダクト運用してみた体験談(Tokyo)
haochenx
0
420
Hermes Engineのチカラを その身で感ぜよう!
haochenx
0
240
Other Decks in Programming
See All in Programming
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
540
git worktree × Claude Code × MCP ~生成AI時代の並列開発フロー~
hisuzuya
1
500
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
280
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
330
技術同人誌をMCP Serverにしてみた
74th
1
390
Bytecode Manipulation 으로 생산성 높이기
bigstark
2
380
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
220
Code as Context 〜 1にコードで 2にリンタ 34がなくて 5にルール? 〜
yodakeisuke
0
110
エンジニア向け採用ピッチ資料
inusan
0
160
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
110
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
540
GoのGenericsによるslice操作との付き合い方
syumai
3
690
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
800
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Transcript
Haochen Kotoi-Xie on 2024-04-12 (bd15w5) ࣾΞϓϦͰ Cloudflare D1Λ ϓϩμΫτӡ༻ͯ͠Έͨମݧஊ @Cloudflare
Meetup Nagoya @ฐࣾ
Cloudflare D1ͬͯΈͨ ࠷ۙ GA ʹͳͬͨ
+ 㱺 Cloudflare D1 ͬ͘͟Γ D1
㱺 Cloudflare D1 Region = Global! ΦϨϯδ৭ͷ SQLite! ͬ͘͟Γ D1
+
ެࣜʹΑΔͱ? Cloudflare D1 ग़య: https://www.cloudflare.com/developer-platform/d1/
ฐࣾ homepage: kxc.inc • Target: ʮଧࠁγεςϜʯ • Status: ϓϩμΫγϣϯӡ༻ •
Tech Stack: Workers + D1 • Complexity: ͍ • Total Satisfaction: ·͊·͊ • Code Matuality: ࡶ • Code Performance: ͱͯΑ͍ D1 ͬͯΈͨ
ฐࣾ homepage: kxc.inc • Target: ʮଧࠁγεςϜʯ • Status: ϓϩμΫγϣϯӡ༻ •
Tech Stack: Workers + D1 • Complexity: ͍ • Total Satisfaction: ·͊·͊ • Code Matuality: ࡶ • Code Performance: ͱͯΑ͍ ར༻Πϝʔδ D1 ͬͯΈͨ
D1 ͬͯΈͨ • Target: ʮଧࠁγεςϜʯ • Status: ϓϩμΫγϣϯӡ༻ • Tech
Stack: Workers + D1 • Code Matuality: Ұ࠷దԽͯ͠ͳ͍ • Complexity: ͍ • System Performance: ͱͯΑ͍ • Total Satisfaction: ·͊·͊ ฐࣾ homepage: kxc.inc
ར༻Πϝʔδʢଧࠁʣ Request Journey 1. Cmd: ʮpunch ...ʯ 2. HTTP POST
㱺 api1.kxc.inc/worklogger/v0/punching 3. Cloudflare Workers (api1.kxc.inc)㱺 Cloudflare D1 db = context.env.D1_WORKLOGGER st = db.prepare(`...sql..(?, ?, ?1)..`) .bind(param1, param2) await db.exec(st) D1 ͬͯΈͨ
ײ • ͱʹ͔͍͍͘͢ (Workers ͔Βͩͱ) • ૣ͍! ͍҆! • 㱺
listing ͷࡶίʔυͰ CPU Time ~30ms • ~2,000ߦ૯ͳΊ + JSσʔλ͝ʹΐ͝ʹΐ, etc • latency 2ܻmsɺମײͰແࢹͰ͖ΔϨϕϧ ར༻Πϝʔδʢlistingʣ D1 ͬͯΈͨ
Usage Stat ײ • ͱʹ͔͍͍͘͢ (Workers ͔Βͩͱ) • ૣ͍! ͍҆!
• 㱺 listing ͷࡶίʔυͰ CPU Time ~30ms • ~2,000ߦ૯ͳΊ + JSσʔλ͝ʹΐ͝ʹΐ, etc • latency 2ܻmsɺମײͰແࢹͰ͖ΔϨϕϧ • 1 >5k Request ͰແྉʹͳΔݟࠐΈ (Paid Workers) • ࠷େ 1 DB 10GB ·ͰΒ͍͠ • Transaction ͳ͍ͷ͕ਏ͍.. (SQLite ͳͷͰɺ stored function ͳ͍..) • Batch ͞Εͨͷ 1 txn Ͱ͕͢.. D1 ͬͯΈͨ
• 1DB 10GB ·Ͱ! (ࠓ·Ͱ 100MB → 1GB) • λΠϜτϥϕϧ!
• σʔλ Export / Import ※ͳΜͱࠓ·ͰͰ͖ͳ͔ͬͨ :D • άϩʔόϧɾϨϓϦΧ • Account͝ͱ: 50,000 DB! (max storage = 250GB) ※ιϑτϦϛοτΒ͍͠ • ແྉͰ࢝ΊΒΕΔ! • ແྉ: 10DB, 500MB/DB, 5GB/Account, 5M read /day, 100K write /day ࠷ۙ GA (General Available) ʹͳͬͨΒ͍͠ Cloudflare D1
Cloudflare D1 ݁ (Txn ΄͍͚͠Ͳ..) D1 ͍͍ͧ!
Cloudflare D1 Region = Global! ΦϨϯδ৭ͷ SQLite! ͓ΘΓ