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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Haochen Kotoi-Xie
April 24, 2024
Technology
640
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
390
社内アプリで Cloudflare D1を プロダクト運用してみた体験談 @Cloudflare Meetup Nagoya
haochenx
0
250
Hermes Engineのチカラを その身で感ぜよう!
haochenx
0
290
Other Decks in Technology
See All in Technology
hackers_champloo_2026_tidb
makocchi
0
170
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
190
フィンテック養成勉強会#68
finengine
0
150
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
200
Rust で関数型ドメインモデリング
takonda
0
170
OptunaHub: ブラックボックス最適化のためのプラットフォーム
pfn
PRO
0
140
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
370
データエンジニアの次の戦場は "プロセスエンジニアリング"
sansantech
PRO
1
100
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
670
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
470
PHPカンファレンス関西の招待状 / Invitation to PHP Conference Kansai
ykanoh
0
210
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
170
Featured
See All Featured
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
370
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Google's AI Overviews - The New Search
badams
0
1.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
2
2k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
500
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
480
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How GitHub (no longer) Works
holman
316
150k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
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