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
150
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
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
170
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
470
AWS CDKを用いたセキュアなCI/CDパイプラインの構築 / Build a secure CI/CD pipeline using AWS CDK
seike460
PRO
3
620
いまあるチームにフィットさせる Serverless そして Platform Engineeringへの挑戦 / Serverless Fits the Team You Have and Platform Engineering
seike460
PRO
2
1.6k
いまあるチームにフィットさせる Serverless / Serverless fits in with the team you have now.
seike460
PRO
2
140
地方こそサーバーレス! チームにフィットさせるサーバーレス / Rural areas are serverless! Serverless to Fit Your Team
seike460
PRO
1
93
AWS X-Rayを利用したサーバーレスのパフォーマンス分析 / Serverless performance analysis using AWS X-Ray
seike460
PRO
2
140
Cloudflare Workers x AWS Lambdaの組み合わせユースケース / Cloudflare Workers x AWS Lambda Combination Use Case
seike460
PRO
2
440
技術力を高め合う “開けた”企業間コミュニティの形成 / Formation of an "open" inter-company community to enhance technological capabilities
seike460
PRO
1
81
Other Decks in Programming
See All in Programming
Scan with Decoupled Look-back and Onesweep Radix Sort
shocker_0x15
0
100
Pydantic x Database API:turu-pyの開発
yassun7010
1
720
Kubernetes上でOracle_Databaseの運用を楽にするOraOperatorの紹介
nnaka2992
0
150
Progressive Web Apps for Rails developers
siaw23
2
550
レイトレ合宿10 レンダラー紹介 / Renderer Introduction, Ray Tracing Camp 10
shocker_0x15
0
430
現場から考えるソフトウェアエンジニアリングの価値と実験
nomuson
1
130
Integrating AI in Your Enterprise Java Applications
ivargrimstad
0
290
Jakarta EE as Seen Trough the Lens of the ASF
ivargrimstad
0
280
tsconfig.jsonの最近の新機能 ファイルパス編
uhyo
6
1.7k
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
510
空間の中でアイドルとレッスンする技術 - 1st "Vision" / Spatial Lesson technologies with my idol - 1st "Vision"
banjun
PRO
0
150
Beyond Laravel Octane - Hyperf for Laravel Artisans
albertcht
1
140
Featured
See All Featured
Unsuck your backbone
ammeep
668
57k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.6k
The Invisible Customer
myddelton
119
13k
Into the Great Unknown - MozCon
thekraken
31
1.4k
Teambox: Starting and Learning
jrom
132
8.7k
The Brand Is Dead. Long Live the Brand.
mthomps
53
38k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9k
RailsConf 2023
tenderlove
28
850
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Art, The Web, and Tiny UX
lynnandtonic
296
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/