Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
社内アプリで 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
家のリアーキテクト・リファクタリング
suguruooki
0
110
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
340
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
190
【視聴者参加型!】AWSセキュリティアンチパターンクイズ
syoshie
1
490
20260906 「AWS運用入門」著者が教える、運用業務への生成AI活用入門
masaruogura
0
260
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
620
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
180
Sigmaで作る業務アプリ
kazushiro_honma
0
120
Multica × 長期記憶:40個のミニプロジェクト管理
eiei114
1
240
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
130
AIオーケストレーションを活用した 開発ワークフローの設計と実践
bqnq
0
130
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
570
Tell your own story through comics
letsgokoyo
1
1.1k
We Have a Design System, Now What?
morganepeng
55
8.3k
Designing for Timeless Needs
cassininazir
1
470
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
620
Chasing Engaging Ingredients in Design
codingconduct
0
300
Site-Speed That Sticks
csswizardry
13
1.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
A better future with KSS
kneath
240
18k
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