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 Workersのデータストア、KVとD1を比較してみる / Cloud...
Search
shiro seike
PRO
July 22, 2023
Programming
940
0
Share
Cloudflare Workersのデータストア、KVとD1を比較してみる / Cloudflare Workers datastore, comparing KV and D1.
Cloudflare Meetup Oita Kick off!!
https://cfm-cts.connpass.com/event/285212/
shiro seike
PRO
July 22, 2023
More Decks by shiro seike
See All by shiro seike
Why Continue AWS Community Builders
seike460
PRO
0
61
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
170
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
250
AI-DLC 入門 〜AIコーディングの本質は「コード」ではなく「構造」〜 / Introduction to AI-DLC: The Essence of AI Coding Is Not “Code” but “Structure”
seike460
PRO
0
890
今さら聞けないサーバーレスのいいところ 〜運用から解放される世界を目指して〜 / The Benefits of Serverless You Might Be Too Embarrassed to Ask About Now — Aiming for a World Free from Operational Burdens
seike460
PRO
0
95
AWS Lambda Durable Functions のユースケースを探る / Exploring Use Cases for AWS Lambda Durable Functions
seike460
PRO
0
85
歴史から学ぶ「Why PHP?」 PHPを書く理由を改めて理解する / Learning from History: “Why PHP?” Rediscovering the Reasons for Writing PHP
seike460
PRO
0
470
Team-First Serverless Platform Engineering Approach to PHP Applications with Laravel and Bref
seike460
PRO
1
150
地方だからできる!コミュニティ参加と登壇を続ける意義 / “It’s Possible Because We’re in a Regional Area!” The Significance of Continuing to Participate in and Speak at Community Events
seike460
PRO
0
24
Other Decks in Programming
See All in Programming
[RubyKaigi 2026] Require Hooks
palkan
1
320
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
160
My daily life on Ruby
a_matsuda
3
380
AI時代になぜ書くのか
mutsumix
0
400
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
開発とはなにか、Essenceカーネルで見えるもの
ukin0k0
0
170
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
770
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
440
Agentic AI & UI: Arcitecture, HITL, Emerging Standards
manfredsteyer
PRO
0
100
Agentic Elixir
whatyouhide
0
450
継続的な負荷検証を目指して
pyama86
3
1.2k
要はバランスからの卒業 #yumemi_grow
kajitack
0
160
Featured
See All Featured
Building the Perfect Custom Keyboard
takai
2
750
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.4k
Design in an AI World
tapps
1
210
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Test your architecture with Archunit
thirion
1
2.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
300
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
150
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
180
YesSQL, Process and Tooling at Scale
rocio
174
15k
Transcript
Cloudflare Workers KV D 1 Cloudflare Meetup Oita Kick
off!! 2 0 23 . 07 . 22 @seike 4 60 1
@seike 460 - - @seike 46 0 - Fusic -
/ - / - - Cloudflare Meet-up Fukuoka Organizer - ServerlessDays 20 23 Organizer - JAWS Festa 2023 Staff 2
Agenda 1 .Cloudflare Workers 2 .Cloudflare Workers KV 3 .Cloudflare
D 1 4 .Workers KV D 1 5 .Workers KV D 1 3
01 Cloudflare Workers
Cloudflare Workers Workers Cloudflare Web Workers Cloudflare Developer
Platform 5
02 Cloudflare Workers KV
Cloudflare Workers KV Key-Value 275 Key-Value
7
03 Cloudflare Workers KV
Cloudflare Workers D 1 D 1 Cloudflare D 1 SQLite
SQL Web 9
04 Workers KV D 1
11 GA I/F Wokers 1 10 JS - KV 1
10 1 1,000 Key-Value ? D 1 Read units 5 million / day Write units 100 , 00 0 / day SQL ? 10 KV 1000 ? ? ?
None
05 Workers KV D 1
KV 14 export const getPresentationsKV = async (KV: KVNamespace): Promise<string
| null> => { const startTimePut = performance.now(); for (let i = 0; i < 100; i++) { await KV.put(i.toString(), i.toString()); } const endTimePut = performance.now(); let putTime = endTimePut - startTimePut; for (let i = 0; i < 100; i++) { const value = await KV.get(i.toString()); } const endTimeGet = performance.now(); const getTime = endTimeGet - endTimePut; return 'putTime: ' + putTime + ' - getTime: ' + getTime; };
D 1 15 export const getPresentation = async (DB: D1Database,
id: string): Promise<Presentation | undefined> => { await DB.prepare('DELETE FROM Presentations').run(); const startTimePut = performance.now(); for (let i = 0; i < 100; i++) { await DB.prepare('INSERT INTO Presentations (id) VALUES (?)’) .bind(i.toString()).run(); } const endTimePut = performance.now(); let putTime = endTimePut - startTimePut; for (let i = 0; i < 100; i++) { const value = await DB.prepare('SELECT id FROM Presentations WHERE id = ?') .bind(i.toString()) .first(); } const endTimeGet = performance.now(); const getTime = endTimeGet - endTimePut; const newPresentation: Presentation = { name: 'putTime: ' + putTime + ' - getTime: ' + getTime, }; return newPresentation; };
KV Insert putTime --------- 2 34 2 6 getTime ---------
1 22 2 KV Update putTime --------- 2 37 6 3 getTime --------- 1 25 4 D 1 putTime --------- 1 98 3 2 getTime --------- 1 53 8 5 16
Point KV D 1 D 1 β
Serverless Days Tokyo 2023 18
Thank You We are Hiring ! https://recruit.fusic.co.jp/