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
710
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
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
3
880
生成AIコーディングとの向き合い方、AIと共創するという考え方 / How to deal with generative AI coding and the concept of co-creating with AI
seike460
PRO
1
440
地方のPHPerもクラウドを使う理由 ~コストの最適化とチームに向き合う~ / Why even local PHPers use the cloud ~optimize costs and face the team
seike460
PRO
0
74
OpenTelemetryで始めるベンダーフリーなobservability / Vendor-free observability starting with OpenTelemetry
seike460
PRO
0
210
AIコーディングの本質は“コード“ではなく“構造“だった / The essence of AI coding is not “code” but "structure
seike460
PRO
2
1.2k
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
1
820
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
420
実行委員長が振り返るBacklogWorldの裏側と運営Backlog術 / The chairperson of the executive committee looks back on the backstage of BacklogWorld and the art of managing Backlog.
seike460
PRO
0
15
Amazon Aurora DSQLパフォーマンスチェック / Amazon Aurora DSQL Performance Check
seike460
PRO
0
31
Other Decks in Programming
See All in Programming
CSC509 Lecture 08
javiergs
PRO
0
230
Vueのバリデーション、結局どれを選べばいい? ― 自作バリデーションの限界と、脱却までの道のり ― / Which Vue Validation Library Should We Really Use? The Limits of Self-Made Validation and How I Finally Moved On
neginasu
2
350
Software Architecture
hschwentner
6
2.3k
Six and a half ridiculous things to do with Quarkus
hollycummins
0
210
Pythonに漸進的に型をつける
nealle
1
110
オープンソースソフトウェアへの解像度🔬
utam0k
17
3.1k
エンジニアインターン「Treasure」とHonoの2年、そして未来へ / Our Journey with Hono Two Years at Treasure and Beyond
carta_engineering
0
410
バッチ処理を「状態の記録」から「事実の記録」へ
panda728
PRO
0
190
コード生成なしでモック処理を実現!ovechkin-dm/mockioで学ぶメタプログラミング
qualiarts
0
250
Leading Effective Engineering Teams in the AI Era
addyosmani
7
570
Developer Joy - The New Paradigm
hollycummins
1
340
What's new in Spring Modulith?
olivergierke
1
160
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Facilitating Awesome Meetings
lara
57
6.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Statistics for Hackers
jakevdp
799
220k
Fireside Chat
paigeccino
40
3.7k
GitHub's CSS Performance
jonrohan
1032
470k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
Building Better People: How to give real-time feedback that sticks.
wjessup
369
20k
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/