Is it ok to update a CDN cached json file every 5 seconds?

Hi, Is it ok if I purge & revalidate a json file that is stored on cloudflares free CDN, every 5 (or 10) seconds?
or is that against cloudflares fair use rules?

I really don’t see why not. It’s just an API call, and one per five seconds is within their rate limit.
https://developers.cloudflare.com/cache/how-to/purge-cache

The only thing I would test would be how long it takes for the purge to take effect. It used to be that changes can take up to thirty seconds to propagate. It even says that when you do a Purge from the dashboard.

It’s generally much, much less, but I don’t know how the system will behave if your purges start stacking up. Again…may be worth some testing from various locations to see how long after a purge until it shows a MISS.

3 Likes

thanks a lot!! What exactly is the rate limit how frequently I can purge one single resources? I think it’s basically possible to start a purge ever millisecond, right? i saw only the 1000urls/min limit

that’s true!! but if multiple purge request stack up, that will be basically multiple delete & revalidate requests, right? what exactly do you mean with ‘miss’?

If you opt for every 10 seconds, I think you’ll be fine in every way. It’s way below the purge rate limit, and I’m highly confident that the purge will execute in less than five seconds, so ten should be safe and effective.

CF-Cache-Status in the response header:

https://developers.cloudflare.com/cache/about/default-cache-behavior#cloudflare-cache-responses

1 Like

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