From 7c48382a9b357c97dfb964d5dcd96afb23232a24 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin Date: Mon, 18 Nov 2024 09:48:41 -0500 Subject: [PATCH 1/5] [KV]: add kv vs d1 --- .../docs/workers/platform/storage-options.mdx | 2 ++ src/content/partials/kv/kv-vs-d1.mdx | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/content/partials/kv/kv-vs-d1.mdx diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index ed1c046de1c260a..06ddf40a8d247bb 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -213,6 +213,8 @@ The new beta version of Durable Objects is available where each Durable Object h ::: + + ## D1 vs Hyperdrive D1 is a standalone, serverless database that provides a SQL API, using SQLite's SQL semantics, to store and access your relational data. diff --git a/src/content/partials/kv/kv-vs-d1.mdx b/src/content/partials/kv/kv-vs-d1.mdx new file mode 100644 index 000000000000000..567d7a69c126fb8 --- /dev/null +++ b/src/content/partials/kv/kv-vs-d1.mdx @@ -0,0 +1,14 @@ +--- +{} +--- + +## Workers KV vs D1 + +Cloudflare Workers KV provides an eventually consistent global key-value store that caches data throughput Cloudflare's network to provide +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. + +Cloudflare D1 provides a SQL database that supports relational data modeling and quering. D1 supports snapshot isolation consistency and is ideal for +workloads that store user data or general web application data. D1 currently stores data regionally (with read replicas coming soon). + +- 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. +- 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). From 808ed12fe26ae0721f54bc510ceec1cf891ce876 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:59:30 -0500 Subject: [PATCH 2/5] Update src/content/partials/kv/kv-vs-d1.mdx Co-authored-by: Vy Ton --- src/content/partials/kv/kv-vs-d1.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/kv/kv-vs-d1.mdx b/src/content/partials/kv/kv-vs-d1.mdx index 567d7a69c126fb8..d5977cd947b991f 100644 --- a/src/content/partials/kv/kv-vs-d1.mdx +++ b/src/content/partials/kv/kv-vs-d1.mdx @@ -4,7 +4,7 @@ ## Workers KV vs D1 -Cloudflare Workers KV provides an eventually consistent global key-value store that caches data throughput Cloudflare's network to provide +Cloudflare Workers KV provides an eventually consistent global key-value store that caches data throughout Cloudflare's network to provide 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. Cloudflare D1 provides a SQL database that supports relational data modeling and quering. D1 supports snapshot isolation consistency and is ideal for From 3758ab7b8ab18736386b6059acf3a173a3841287 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:59:38 -0500 Subject: [PATCH 3/5] Update src/content/partials/kv/kv-vs-d1.mdx Co-authored-by: Vy Ton --- src/content/partials/kv/kv-vs-d1.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/kv/kv-vs-d1.mdx b/src/content/partials/kv/kv-vs-d1.mdx index d5977cd947b991f..02abb1f4dd74855 100644 --- a/src/content/partials/kv/kv-vs-d1.mdx +++ b/src/content/partials/kv/kv-vs-d1.mdx @@ -7,7 +7,7 @@ Cloudflare Workers KV provides an eventually consistent global key-value store that caches data throughout Cloudflare's network to provide 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. -Cloudflare D1 provides a SQL database that supports relational data modeling and quering. D1 supports snapshot isolation consistency and is ideal for +Cloudflare D1 provides a SQL database that supports relational data modeling and querying. D1 supports snapshot isolation consistency and is ideal for workloads that store user data or general web application data. D1 currently stores data regionally (with read replicas coming soon). - 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. From f507a3b26210515c18b961f688685fea066e9946 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:00:03 -0500 Subject: [PATCH 4/5] Update src/content/partials/kv/kv-vs-d1.mdx Co-authored-by: Vy Ton --- src/content/partials/kv/kv-vs-d1.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/kv/kv-vs-d1.mdx b/src/content/partials/kv/kv-vs-d1.mdx index 02abb1f4dd74855..e365083cb816353 100644 --- a/src/content/partials/kv/kv-vs-d1.mdx +++ b/src/content/partials/kv/kv-vs-d1.mdx @@ -10,5 +10,5 @@ low read latency for hot reads to keys. This is ideal for storing data that is r Cloudflare D1 provides a SQL database that supports relational data modeling and querying. D1 supports snapshot isolation consistency and is ideal for workloads that store user data or general web application data. D1 currently stores data regionally (with read replicas coming soon). -- 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. +- Use Workers KV if you need to store and access configuration data that will be read by Workers frequently, is written infrequently (\<1 RPS per key) and can tolerate eventual consistency. - 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). From 51c4b93d89fcdda371e5d7a217da20320173d5b2 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:03:52 -0500 Subject: [PATCH 5/5] Update src/content/partials/kv/kv-vs-d1.mdx Co-authored-by: Vy Ton --- src/content/partials/kv/kv-vs-d1.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/partials/kv/kv-vs-d1.mdx b/src/content/partials/kv/kv-vs-d1.mdx index e365083cb816353..879e028c5396a4f 100644 --- a/src/content/partials/kv/kv-vs-d1.mdx +++ b/src/content/partials/kv/kv-vs-d1.mdx @@ -8,7 +8,7 @@ Cloudflare Workers KV provides an eventually consistent global key-value store t 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. Cloudflare D1 provides a SQL database that supports relational data modeling and querying. D1 supports snapshot isolation consistency and is ideal for -workloads that store user data or general web application data. D1 currently stores data regionally (with read replicas coming soon). +workloads that store user data or general web application data. - Use Workers KV if you need to store and access configuration data that will be read by Workers frequently, is written infrequently (\<1 RPS per key) and can tolerate eventual consistency. - 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).