From 84092c309424da615dc645b38e352e23c5328084 Mon Sep 17 00:00:00 2001 From: Nicolas Dorseuil Date: Sun, 25 May 2025 15:55:42 +0200 Subject: [PATCH 1/2] docs for regional replication of the tag cache --- pages/cloudflare/caching.mdx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pages/cloudflare/caching.mdx b/pages/cloudflare/caching.mdx index 6ffd02c..006ebbe 100644 --- a/pages/cloudflare/caching.mdx +++ b/pages/cloudflare/caching.mdx @@ -185,7 +185,18 @@ export default defineCloudflareConfig({ incrementalCache: withRegionalCache(r2IncrementalCache, { mode: "short-lived" }), queue: doQueue, // This is only required if you use On-demand revalidation - tagCache: doShardedTagCache({ baseShardSize: 12 }), + tagCache: doShardedTagCache({ + baseShardSize: 12, + regionalCache: true, // Enable regional cache to reduce the load on the DOs + regionalCacheTtlSec: 5, // The TTL for the regional cache + shardReplication: { + numberOfSoftReplicas: 4, + numberOfHardReplicas: 2, + regionalReplicationOptions: { + defaultRegion: "enam", + }, + }, + }), // Disable this if you want to use PPR enableCacheInterception: true, }); @@ -618,6 +629,8 @@ doShardedTagCache takes the following options: - `shardReplication`: Enable replicating the Shard. Shard replication will duplicate each shards into replicas to spread the load even more - `numberOfSoftReplicas`: Number of replicas for the soft tag shards - `numberOfHardReplicas`: Number of replicas for the hard tag shards + - `regionalReplicationOptions` : This setting enables you to replicate shards across different regions, thereby reducing read latency and distributing the load more evenly. By enabling this option, each shard will be replicated in all available regions. Please note that this will increase the number of Durable Objects (DOs) created and the volume of write requests sent to the DOs. + - `defaultRegion`: The default region to use for the replication. - `maxWriteRetries`: The number of retries to perform when writing tags From 8a05211326f30f11dd4c3e5b55e9e99835073696 Mon Sep 17 00:00:00 2001 From: conico974 Date: Mon, 26 May 2025 13:59:36 +0200 Subject: [PATCH 2/2] Update pages/cloudflare/caching.mdx Co-authored-by: Victor Berchet --- pages/cloudflare/caching.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/cloudflare/caching.mdx b/pages/cloudflare/caching.mdx index 006ebbe..270ea6d 100644 --- a/pages/cloudflare/caching.mdx +++ b/pages/cloudflare/caching.mdx @@ -192,7 +192,7 @@ export default defineCloudflareConfig({ shardReplication: { numberOfSoftReplicas: 4, numberOfHardReplicas: 2, - regionalReplicationOptions: { + regionalReplication: { defaultRegion: "enam", }, },