Well, it feels like it's automatically replicated, but your KV content is usually only stored in a few select datacenters until it becomes popular (and is then available on all DCs). This process is usually fairly quick (<50ms for a 10mb file, based on my testing from about a year ago) so it's almost imperceivable.
https://developers.cloudflare.com/workers/learning/how-kv-wo...
> It is optimized for these high-read applications, only reaching its full performance when data is being frequently read. Very infrequently read values are stored centrally, while more popular values are maintained in all of our data centers around the world.
Flexibility of Cloudflare KV reads in general still yield quick enough results and make doing a quick and dirty cache a pretty good use case IMHO.
But Worker Sites specifically also use the Cloudflare Worker Cache runtime API — aka, per each POP, first reads of a route (index.html, blah.css, cat.jpg) are from KV and THEN cached indefinitely cutting that time to like 10ms.
This is taken then even further by using ETAG matching to make BrowserTTL indefinite (304s not 200s) on all assets until cleared cutting repeat visitors (regardless of POP) to basically nothing. Though .html for some reason doesn’t respect this (I think...).
Which to me is a GREAT deal!
Cache Object: https://developers.cloudflare.com/workers/runtime-apis/cache
Asset Mapper: https://github.com/cloudflare/kv-asset-handler/blob/master/s...
Lines 181 and 224
The only time the request needs to hit the origin is if nobody fetched the page.
To speed it up further, you can tell Cloudflare to cache your HTML pages. Now you've eliminated that round-the-world trip (for most visitors), but you've also lost some of the dynamicness of your site. At that point, you're basically building a static site by different means.
In the confidence it caches the HTML, and the plugin triggers a CDN purge when the HTML changes
Coupled with Cloudflare's standards support (TLS 1.2, H2, H3), and their image optimisation services it's really great for performance.
Just got to remember to disable many of the WP 'speed optimisation' plugins that may be installed as they actually can cause more speed issues.
But probably not against a static page.
Wordpress is still PHP and a Database and whatever crazy plugins, templates and front end builders are involved.
Depending on how much JAM you have in your STACK, your site/app may or may perform better than WP.
I build a ton of sites in Jekyll, which are static sites and not JAMSTACK. The two get conflated.
So then, they said why not just upload your static site into the KV database, where the key might be "/index.html" and the value is the html content of that page. Then have a short javascript that reads from that KV and returns the requested page. They wrote some client-side scripts to simplify the uploading, and Workers Sites was born!
I love how your content is automatically replicated to all of their datacenters and loads super-fast from everywhere in the world. I also love that it's really cheap.
But the downside is how some features in Cloudflare's control panel don't work if you're hosting your static site this way. For example, I wanted to use the Page Rules to redirect /page1.html to /page2.html. I also wanted to use Page Rules to set browser caching for *.jpg files. But it turns out that Cloudflare Workers execute code before the Page Rules feature does, so it doesn't work! I had to solve both issues by changing their default javascript to build in redirects and browser caching manually. Not too hard, but annoying.