Yikes, that's really disappointing.

Yikes, that's really disappointing. Thanks for the info. I'm coming to the realisation that CF is only really beneficial for very high traffic sites -- I wonder if all CDNs are as quick to evict cache entries.
27 Replies
Chaika
Chaika8mo ago
is CF specifically that quick to evict? I don't think they are, could vary a bit with the colocation center you are connecting to though/might be seeing the result of a multi-colo pop where each colo has different cache
Chaika
Chaika8mo ago
this asset has only got a handful of requests over the last 24 hours
No description
Chaika
Chaika8mo ago
but still firmly in cache
No description
Chaika
Chaika8mo ago
that's what, 18 hours cache age and it didn't even have requests for the last ~6 hours no tiered caching or anything enabled on that hostname
Rich
RichOP8mo ago
I wonder if it's less likey to evict js or perhaps the file size is v. small? We cache a bunch of API requests to origin with the Cache API and often see a miss if left for 10mins or so
Chaika
Chaika8mo ago
I wonder if it's less likey to evict js or perhaps the file size is v. small?
Maybe, the only bit that I know was clarified to us was that - Cache is based on Access Frequency - Cache does not care about zone plan It depends a bit too on how exactly you are measuring it Cache API is local colo only, some PoPs like EWR are actually like ~5 colos in one, all with their own cache, and you have no specific affinity to one besides for keepalive
Rich
RichOP8mo ago
Yeah this is why I want to get tiered caching, as it seems we don't have enough traffic to prime all the individual colo caches. tbh I don't have great visibility into the cache because the cache keys we use are pretty obfusicated (POST body hashes) similar to this https://developers.cloudflare.com/workers/examples/cache-post-request/ I'm not even sure Cache API entries are shown in the cache performance graph
Chaika
Chaika8mo ago
the one in the dashboard "Cache Analytics" excludes them The caching overview filters requests to only show ones made by eyeballs/actual users, via the "requestSource" There's edgeWorkerFetch and edgeWorkerCacheAPI which workers fall under could view them via graphql still
Rich
RichOP8mo ago
ah nice, will take a look thanks
Chaika
Chaika8mo ago
{
"httpRequestsAdaptiveGroups": [
{
"count": 26361,
"dimensions": {
"cacheStatus": "none",
"requestSource": "purge"
}
},
{
"count": 449461,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "eyeball"
}
},
{
"count": 20999,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 6,
"dimensions": {
"cacheStatus": "stale",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 19,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "imageResizing"
}
},
{
"count": 1109768,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 821635,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "eyeball"
}
},
{
"count": 8234,
"dimensions": {
"cacheStatus": "dynamic",
"requestSource": "eyeball"
}
},
{
"count": 16,
"dimensions": {
"cacheStatus": "stale",
"requestSource": "eyeball"
}
},
{
"count": 368,
"dimensions": {
"cacheStatus": "revalidated",
"requestSource": "eyeball"
}
},
{
"count": 280,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 33140872,
"dimensions": {
"cacheStatus": "none",
"requestSource": "eyeball"
}
},
{
"count": 7592,
"dimensions": {
"cacheStatus": "none",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 1725937,
"dimensions": {
"cacheStatus": "dynamic",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 1773386,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 8,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "imageResizing"
}
},
{
"count": 7113,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 25303,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 2618914,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "eyeball"
}
},
{
"count": 60514,
"dimensions": {
"cacheStatus": "none",
"requestSource": "edgeWorkerFetch"
}
}
{
"httpRequestsAdaptiveGroups": [
{
"count": 26361,
"dimensions": {
"cacheStatus": "none",
"requestSource": "purge"
}
},
{
"count": 449461,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "eyeball"
}
},
{
"count": 20999,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 6,
"dimensions": {
"cacheStatus": "stale",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 19,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "imageResizing"
}
},
{
"count": 1109768,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 821635,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "eyeball"
}
},
{
"count": 8234,
"dimensions": {
"cacheStatus": "dynamic",
"requestSource": "eyeball"
}
},
{
"count": 16,
"dimensions": {
"cacheStatus": "stale",
"requestSource": "eyeball"
}
},
{
"count": 368,
"dimensions": {
"cacheStatus": "revalidated",
"requestSource": "eyeball"
}
},
{
"count": 280,
"dimensions": {
"cacheStatus": "miss",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 33140872,
"dimensions": {
"cacheStatus": "none",
"requestSource": "eyeball"
}
},
{
"count": 7592,
"dimensions": {
"cacheStatus": "none",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 1725937,
"dimensions": {
"cacheStatus": "dynamic",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 1773386,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "edgeWorkerFetch"
}
},
{
"count": 8,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "imageResizing"
}
},
{
"count": 7113,
"dimensions": {
"cacheStatus": "expired",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 25303,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "edgeWorkerCacheAPI"
}
},
{
"count": 2618914,
"dimensions": {
"cacheStatus": "hit",
"requestSource": "eyeball"
}
},
{
"count": 60514,
"dimensions": {
"cacheStatus": "none",
"requestSource": "edgeWorkerFetch"
}
}
yea there's a whole bunch of types and again only the cache analytics shows "eyeball" { "count": 25303, "dimensions": { "cacheStatus": "hit", "requestSource": "edgeWorkerCacheAPI" } vs other types (miss/expired/stale) would probably be what you'd be after
Rich
RichOP8mo ago
cool, I'm going to try and shove that into a graph to see if the cache really is as ineffective for us as I think it is 👍 weirdly, I don't see any edgeWorkerCacheAPI sources in my zone 🤔 plenty of edgeWorkerFetch though -- even though we don't use the fetch caching
Chaika
Chaika8mo ago
that'd appear if you are fetching out at all though, caching or not hmm and you're using cache api on a worker attached to that zone? Pages Functions would always be executing in the context of the pages.dev, for example
Rich
RichOP8mo ago
ah ok, I suppose it still potentially caches responaes if the origin headers allow it -- regardless of passing cf cache ttl fetch('foo', { cf: { cacheTtl: 5 } })?
Chaika
Chaika8mo ago
those are just overrides yea, you still go through the normal cdn/cache rules/etc
This option forces Cloudflare to cache the response for this request, regardless of what headers are seen on the response. This is equivalent to setting two Page Rules: Edge Cache TTL and Cache Level (to Cache Everything). The value must be zero or a positive number. A value of 0 indicates that the cache asset expires immediately. This option applies to GET and HEAD request methods only.
https://developers.cloudflare.com/workers/runtime-apis/request/#the-cf-property-requestinitcfproperties
Rich
RichOP8mo ago
our "zone" is configured as a custom domain on the worker in question so I'm assuming that means analytics would come under our zone, rathert than pages .dev (we are using CF Pages)
Chaika
Chaika8mo ago
no, if it's a Pages project, you don't have a worker, you have a function, and all invocations of the Pages Function would belong to the pages.dev zone hidden in your account
Rich
RichOP8mo ago
Oh really. Can I view the pages.dev zone? (although last I read that didn't support caching)
Chaika
Chaika8mo ago
Worker: If it's ran via your workers.dev, it's yourworkersubdomain.workers.dev zone Worker: If it's ran via route or custom domain, the request belongs to that zone Function: If it's a Pages Function, it's always the pages.dev zone even if called via a Custom Domain Worker: If it's something that runs without an http request, like crons, queues, etc, it's your workers.dev zone
potentially, 1sec. and no, workers.dev doesn't support cache apibut the pages.dev does If you go to Manage Account -> Audit Log, filter by your pages.dev, you should be able to find an event like a certificate renewal which leaks your zone_id, and then you could search for that in graphql
Chaika
Chaika8mo ago
No description
Chaika
Chaika8mo ago
they're just hidden zones in your account, as far as I know fully functional in all the apis (you can mess with them a fair bit, but I would recommend not doing too much to not upset the pages team lol or they'll lock them down more, reading analytics/settings should be completely fine though) might be an easier way but this is the way i know lol you'll be restricted in the graphql datasets you can use though since they're free zones
Rich
RichOP8mo ago
haha, ok yeah, found the zone which the API recognises, but doesn't let me read httpRequestsAdaptive or httpRequestsAdaptiveGroups 😔 I think I'll ping enterprise support and see if they've got any suggestions on getting visibility into cache usage -- thanks for your help
Cole-kun
Cole-kun8mo ago
Is this still valid? I had a talk with a CF eng recently, and it seems they changed this behavior last month. I tested it with a few colos today and got a HIT immediately after the first MISS, all from different Colo IDs.
Chaika
Chaika8mo ago
without tiered caching? My understanding is still yes, they haven't changed the docs at all either (ex: cache api still mentions originating data center), unless they've done something special with MCPs
Cole-kun
Cole-kun8mo ago
Yes, it was MCP-related. Thank you! I've been trying to remember that name. 😅 It seems Cache API now shares its storage between all DCs in a region. Not as good as Tiered Cache, but definitely much better than before.
Chaika
Chaika8mo ago
that would be nice if true, I don't have any websites with a lot of cached traffic that don't already have tiered caching on though lol, and on those ones I don't see cache miss changing would be interesting if someone had a website without tiered caching and a lot of requests, if their cache miss changed at all it does look suspiciously like it was changed, same age and such even from different colo ids in the same pop, will ask if anyone knows anything
Cole-kun
Cole-kun8mo ago
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "728",
"localCache": false,
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "598",
"localCache": true,
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "97",
"localCache": true,
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "728",
"localCache": false,
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "598",
"localCache": true,
coleplx@argus:~/cloudflare$ curl -sILX GET https://redacted/building-exterior.webp?1bypass2 -H 'x-debug: redacted' | grep -Ei '^x-debug' | cut -d':' -f2- | jq | grep -E 'localCache|ColoId'
"cfColoId": "97",
"localCache": true,
Yep. This Worker route is using Cache API only. I wish they documented or at least announced these changes somewhere, at least here on Discord. 😅 That's valuable information.
Chaika
Chaika8mo ago
times like these I wish I could go back in time and create a monitor to see the performance difference lol I have something monitoring a cached endpoint but it's behind generic tiered cache with middle tier so pretty useless for monitoring this, already had 2 levels
Want results from more Discord servers?
Add your server