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を プロダクト運用してみた体験談(Tokyo)
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Haochen Kotoi-Xie
April 24, 2024
Technology
630
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内アプリで Cloudflare D1を プロダクト運用してみた体験談(Tokyo)
Haochen Kotoi-Xie
April 24, 2024
More Decks by Haochen Kotoi-Xie
See All by Haochen Kotoi-Xie
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
370
社内アプリで Cloudflare D1を プロダクト運用してみた体験談 @Cloudflare Meetup Nagoya
haochenx
0
240
Hermes Engineのチカラを その身で感ぜよう!
haochenx
0
290
Other Decks in Technology
See All in Technology
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
0
270
Driving AI Adoption Using In-House GPUs to Serve Qwen
po3rin
2
460
AIエージェントの開発・提供におけるセキュリティリスクの論点と対策
flatt_security
2
600
Nav2、Nav3 ... はたまた自作?〜 作って理解する Nav3 の設計意図 〜 / Nav2, Nav3 ... or Build Your Own? — Understanding Nav3's design intent by building it from scratch
yanzm
0
260
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
600
2026-09-04 SRE Tech Talk #15 怠惰なTerraform / Lazy Terraform
masasuzu
0
220
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
110
synctest時代のhttptest Go 1.27で変わるHTTPサーバテストの裏側 / go conference2026 synctest and httptest
budougumi0617
0
120
薬剤師(ドメインエキスパート)と一緒に育てる薬局向けAIアシスタント
kakehashi
PRO
2
120
enechainの内製セルフサービスプラットフォーム
hiyosi
0
130
2026/09/10 Spring_Bootから_Jakarta_EE_MicroProfileへの移行
megascus
0
220
GoCon2026 - Open Source, Open World
sanposhiho
1
210
Featured
See All Featured
How GitHub (no longer) Works
holman
316
150k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
310
The Curious Case for Waylosing
cassininazir
1
500
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Navigating Team Friction
lara
192
16k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
230
We Have a Design System, Now What?
morganepeng
55
8.3k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
270
Rails Girls Zürich Keynote
gr2m
96
14k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
GitHub's CSS Performance
jonrohan
1033
470k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
Transcript
Haochen Kotoi-Xie on 2024-04-12 (bd15w5) ࣾΞϓϦͰ Cloudflare D1Λ ϓϩμΫτӡ༻ͯ͠Έͨମݧஊ @Cloudflare
Meetup Nagoya @ฐࣾ Haochen Kotoi-Xie on 2024-04-24 (bd17w3) @Cloudflare Meetup Tokyo ϋΦνΣϯ
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 ͬͯΈͨ KXC Utility Shell made with OCaml
ฐࣾ homepage: kxc.inc • Target: ʮଧࠁγεςϜʯ • Status: ϓϩμΫγϣϯӡ༻ •
Tech Stack: Workers + D1 • Complexity: ͍ • Total Satisfaction: ·͊·͊ • Code Matuality: ࡶ • Code Performance: ͱͯΑ͍ ར༻Πϝʔδ D1 ͬͯΈͨ Web൛͋ΔΑ͒ " KXC Utility Shell made with OCaml
D1 ͬͯΈͨ • Target: ʮଧࠁγεςϜʯ • Status: ϓϩμΫγϣϯӡ༻ • Tech
Stack: Workers + D1 (+ ZT) • Code Matuality: Ұ࠷దԽͯ͠ͳ͍ • Complexity: ͍ • System Performance: ͱͯΑ͍ # • User Satisfaction: ͱͯߴ͍ $ ฐࣾ homepage: kxc.inc
ར༻Πϝʔδʢଧࠁʣ Request Journey 1. Cmd: ʮpunch ...ʯ 2. HTTP POST
㱺 api1.kxc.inc/worklogger/v0/punching 3. ZT 㱺 Cloudflare Workers (api1.kxc.inc) ɹ㱺 Cloudflare D1 db = env.D1_WORKLOGGER st = db.prepare(`...sql..(?, ?, ?1)..`) .bind(param1, param2) await db.exec(st) D1 ͬͯΈͨ 1ؒͰ͔Δ D1 db = env.D1_WORKLOGGER st = db.prepare(`...sql..(?, ?, ?1)..`) .bind(param1, param2) await db.exec(st)
ར༻Πϝʔδʢଧࠁʣ Request Journey 1. Cmd: ʮpunch ...ʯ 2. HTTP POST
㱺 api1.kxc.inc/worklogger/v0/punching 3. ZT 㱺 Cloudflare Workers (api1.kxc.inc) ɹ㱺 Cloudflare D1 db = env.D1_WORKLOGGER st = db.prepare(`...sql..(?, ?, ?1)..`) .bind(param1, param2) await db.exec(st) D1 ͬͯΈͨ 1ؒͰ͔Δ D1 db = env.D1_WORKLOGGER st = db.prepare(`...sql..(?, ?, ?1)..`) .bind(param1, param2) await db.exec(st)
ײ • ͱʹ͔͍͍͘͢ (Workers ͔Βͩͱ) • ૣ͍! ͍҆! • 㱺
listing ͷࡶίʔυͰ CPU Time ~30ms • ~2,200ߦ૯ͳΊ + JSσʔλ͝ʹΐ͝ʹΐ, etc • D1 latency 2ܻmsɺແࢹͰ͖ΔϨϕϧ ར༻Πϝʔδʢlistingʣ D1 ͬͯΈͨ
Usage Stat ײ • ͱʹ͔͍͍͘͢ (Workers ͔Βͩͱ) • ૣ͍! ͍҆!
• 㱺 listing ͷࡶίʔυͰ CPU Time ~30ms • ~2,200ߦ૯ͳΊ + JSσʔλ͝ʹΐ͝ʹΐ, etc • D1 latency 2ܻmsɺແࢹͰ͖ΔϨϕϧ • 1 >5k Request ͰແྉʹͳΔݟࠐΈ (Paid Workers) • ࠷େ 1 DB 10GB ·ͰΒ͍͠ • Transaction ͳ͍ͷ͕ਏ͍.. (SQLite ͳͷͰɺ stored function ͳ͍..) • Batch ͞Εͨͷ 1 txn Ͱ͕͢.. D1 ͬͯΈͨ (ݱঢ়794.62k; @04/24 18:36) ୯७ܭࢉͩͱ ͋ͱ75,950͍͚Δ!
• 1DB 10GB ·Ͱ! (ࠓ·Ͱ 100MB → 1GB) • λΠϜτϥϕϧ!
• σʔλ Export / Import ※ͳΜͱࠓ·ͰͰ͖ͳ͔ͬͨ :D • άϩʔόϧɾϨϓϦΧ to come • 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! ͓ΘΓ
Bonus Smart Placement Δ࣮ଌ Source: ຊ Cloudflare Developers Discord #d1-database