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
0
230
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
Tweet
Share
More Decks by shiro seike
See All by shiro seike
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
60
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
510
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.1k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
350
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
590
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
750
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
2.1k
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
180
地方こそサーバーレス! チームにフィットさせるサーバーレス / Rural areas are serverless! Serverless to Fit Your Team
seike460
PRO
1
120
Other Decks in Programming
See All in Programming
testcontainers のススメ
sgash708
1
120
CSC305 Lecture 26
javiergs
PRO
0
140
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
layerx_20241129.pdf
kyoheig3
2
290
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
良いユニットテストを書こう
mototakatsu
4
1.5k
N.E.X.T LEVEL
pluu
2
300
103 Early Hints
sugi_0000
1
220
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
Security_for_introducing_eBPF
kentatada
0
110
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
530
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Why Our Code Smells
bkeepers
PRO
335
57k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Writing Fast Ruby
sferik
628
61k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Being A Developer After 40
akosma
87
590k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Making the Leap to Tech Lead
cromwellryan
133
9k
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/