Skip to content

Commit 7c48382

Browse files
committed
[KV]: add kv vs d1
1 parent c44dcf3 commit 7c48382

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/content/docs/workers/platform/storage-options.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ The new beta version of Durable Objects is available where each Durable Object h
213213

214214
:::
215215

216+
<Render file="kv-vs-d1" product="kv" />
217+
216218
## D1 vs Hyperdrive
217219

218220
D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
{}
3+
---
4+
5+
## Workers KV vs D1
6+
7+
Cloudflare Workers KV provides an eventually consistent global key-value store that caches data throughput Cloudflare's network to provide
8+
low read latency for hot reads to keys. This is ideal for storing data that is repeatedly read by your Workers, such as configuration data, user preferences, cached values, etc. Workers KV can sustain high read throughput (unlimited requests per second per key) with \<5ms latency globally for hot reads. Workers KV is eventually consistent, so writes may take up to 60 seconds to propagate through Cloudflare's network by default.
9+
10+
Cloudflare D1 provides a SQL database that supports relational data modeling and quering. D1 supports snapshot isolation consistency and is ideal for
11+
workloads that store user data or general web application data. D1 currently stores data regionally (with read replicas coming soon).
12+
13+
- Use Workers KV if you need to store and access configuration data with that will be read by Workers frequently, that is written infrequently (\<1 RPS per key) and can tolerate eventual consistency.
14+
- Use D1 if you need to store general application data, need SQL access to your data, and require strong consistency (writes are immediately visible after being committed).

0 commit comments

Comments
 (0)