CloudFlare cache delay before putting in cache is taking > 1 min?

Hello,

I was load testing the application with the cloudflare cache to validate our cache settings.

The load test went for 1minute and 30seconds, in which only 1 URL was hit by 25 visitors from the same origin (eu-west-3). I was surprised that 100% of response sent by cloudflare during this time was a MISS for the cache.

I doubled checked that no error was present and our origin server is sending the right cache header control: it was the case.

5 minutes later, I re-ran the test, without updating anything, seeing now that 100% of the request were served by cloudflare using the cache.

In my head, I would say that only the 1-15 first visitors shouldn’t hit the cache (time during Cloudflare is storing the cache in their edge servers).

My question is: Is the >1 minute delay normal before cloudflare starts to return cached responses ? Do you have any resources on this ?

Thank you.

Actually the number of MISS in cache can be as high the number of Cloudflare POPs (ATM about 250) as each first request from each POP will land a MISS in cache because Cloudflare is a reverseProxy CDN.

But if the requests are hitting the very same POP it should be cached on the second request even if it sometimes does not cache immediately. Also, the Edge Cache TTL plays a big role here. If it is set too low it will get purged from the Edge Cache very fast and the next request will again be a MISS in cache.

So with a reverseProxy CDN there is no solution for this, but you can conceal the problem by setting the Edge Cache TTL high to make Cloudflare cache it longer at the edge. Anyway, TTL is no guarantee, but that’s how it works… Cloudflare can purge your Cache whenever they want/need to, even before the TTL is reached.

Hope this helps to understand how it works.

We’re in the scenario in which the same POP is getting hit. The TTL is 1 hour. So when you say “even if it sometimes does not cache immediately”, that would the the minute where 100% of the cache was miss ?

Thank you :wink:

Very uncommon and unlikely, I have never experienced that. Can you maybe provide some more information about the file you want to serve by cache, or maybe even a link to it?

Needed infos:

  1. file extension
  2. set Mime Type
  3. filesize
  4. directlink (optional)

Then I could quickly debug that

file extension is html
content type: text/html

Direct link is: https://en.wamiz.fr/news/31871/watch-brave-k9-shot-in-the-line-of-duty-gets-heros-welcome-after-surgery

Thanks.
So you use Cache Everything.

I quickly called the page and the first request was a MISS, but the second one was a HIT:

  1. cf-cache-status: HIT
  2. cf-ray: 65c202e2292b05b7-FRA

So it seems to work on the second request already. If you anyway still do have the same issue on some POPs you probably should open a support ticket and let the engineers debug that. Please make sure you provide as much information as possible.

Ok thank you for checking that :slight_smile:

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