Cloudflare APO cache MISS issues

I upgraded my free Cloudflare plan to include APO late last week in an attempt to improve my Wordpress site’s load times across the world, as I am having a real challenge meeting Google Core Web Vitals 2.5s load time requirement. This is despite the site always showing decent GT Metrix load times. I think the issue is Google using real-world data from visitors on slow networks across the globe. Hence Cloudflare should really help solve this issue by serving up locally cached assets. My site is www.ksl-training.co.uk.

I’ve used Cloudflare for a few months now and whilst it has improved load times a little (it is still not enough to meet Core Web Vitals LCP. There has always been a problem where not all website assets are cached by Cloudflare, leading to round trip delays as those assets are pulled off my server in the UK.

APO (I thought) offered a solution for this as it includes HTML page caching, which always causes a round trip delay to my server when loading any page. As I understood it from the APO FAQ PDF, Workers KV are supposed to ensure that once a page had been requested from one Edge node, that those same assets would then be distributed and become available to the entire Edge network, so that the first visitor to any node then sees the benefit of local cached assets. Unfortunately, this doesn’t seem to be the case. Whilst HTML pages are now always cached, many stylesheets, scripts and images are not cached (showing as MISS) on the first visit to a page. Only the second and subsequent visitors to the same page seem to get fully cached assets.

When all assets and the HTML page are cached Cloudflare APO delivers blisteringly fast load times. GT Metrix shows 0.4s LCP from Vancouver. However, the first visitor gets a much slower LCP due to the MISS cache assets. It is this issue that I believe is leading to my site still failing Core Web Vitals as I am very close to compliance.

A day or so ago, I deleted my Cache Everything Page Rule, which set Edge TTL to one day, as I understand APO sets this at 30 days. but that hasn’t helped. Am I missing something, or does it take a long time to get all my site’s assets to each Cloudflare node? I am keen to try to resolve the problem causing all the MISS cache assets.

Thanks!

Further clarification:
When I said that second visits to a particular page near perfect asset caching in GT Metrix. However, if I revisit the same page from the same GT Metrix test location an hour later, many assets are cache MISS again. So Cloudflare doesn’t seem to hold a cache of these assets.

Has anyone got any thoughts / suggestions on this?!

Edge Cache TTL is a maximum amount of time Cloudflare is allowed to cache an asset. But if a URL is rarely used, it’s going to be evicted from the cache early to make room for frequently used files.

The only way to overcome a slow MISS is to optimize at the host. Do you have a caching plugin, such as WP Fastest Cache?

Thanks for your input.

This could well be the problem as my site gets quite low traffic. Disappointingly, it is not made clear in Cloudflare APO documentation that Edge Cache TTL is the maximum time Cloudflare caches an asset.

I do have a WordPress caching plugin (WP Rocket) which is activated to optimise JavaScript delivery, although WP Rocket’s page caching is turned off by a WP Rocket ‘helper’ app (as per Cloudflare’s recommendations when running APO). I also have the WordPress Cloudflare app installed and set up for APO. Additional Page Rules are running too as per the attachment.

Given the fact that a large number of my site’s assets MISS Cloudflare caching, leading to hosting server round trip delays fetching them, I may re-point the Name Servers away from Cloudflare, back to my VPS server this weekend to gauge what performance benefits (if any) I get from Cloudflare given that Edge caching isn’t working effectively. Even one or two missed assets result in significant page loading delays.

I would be interested to hear what host optimization could be done to try to resolve the MISS cache issues with site assets in a low traffic environment.

Thanks for your useful comments.

Steve

1 Like

That’s really what TTL means for everything. It’s like the expiration date on a bottle of milk.

Imagine TTL for DNS. TTL=24 hours. I don’t want people holding onto my IP address for more than a day because I might need to move servers. Someone decides that’s a minimum and they’ll cache it for a month. I move servers on day 3, but they don’t know about it because they’ve cached beyond 24 hours.

How about for the front page of a newspaper? TTL of one hour because the operator knows they constantly update content. Someone caches it for a day and misses out on a major late morning story.

Thanks, although In my case the MISSed cache assets are stylesheets, scripts and images which don’t change for days and often weeks. I’ve not noticed the problem with dynamically generated HTML pages. APO does seem to cache HTML pretty well.

As the aforementioned assets don’t change much (if at all) it is hard to understand why Cloudflare dumps the cache of them so quickly. This results in many round trip requests from the host server to fetch the missing assets. Even though my server has HTTP2 for concurrent request handling, this still greatly slows down page load times to the point where the CDN may offer little if any load time benefit. The real benefit of a CDN is only seen when all assets are served up at the Edge.

I will see how much benefit I am getting after I switch the Name Servers over tonight to compare my UK hosted virtual server, versus Cloudflare CDN.

Thanks for taking time to write with this information though. I appreciate that.

Steve

As you said, your site is quite low traffic. Cloudflare needs to allocate cache space for resources with a higher request rate.

1 Like

It is for this reason that a CDN may not be beneficial to my site. I will test to find out what benefits I get!

Cloudflare isn’t a typical CDN. It’s an edge cache, which accounts for what you’re seeing.

If you need long-term storage at edge nodes, I suggest you look at some traditional CDN companies. BunnyCDN has this feature (Perma-Cache).

I changed my site’s nameservers back to my UK based Virtual server today, bypassing Clouydflare. Initial speed tests show that the site is actually faster without Cloudflare, even when testing from Vancouver. This doesn’t surprise me given the number of round-trip file fetches that were going on to get the files Cloudflare didn’t keep cache of. It looks like I have wasted a lot of time and APO is pretty useless for low traffic sites like mine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.