Does Cache Reserve have to be turned on to use cdn caching?

I get that when cloudflare does cdn acceleration, it can save data to the following nodes. Does this feature require the cache reserve charge to be enabled?

Second, when I enable cache reserve, how do I know if my video file is cached by the following cdn node?

thankyou verymuch

You don’t need to enable Cache Reserve to use the normal cache. Cache Reserve is a extra feature which uses R2 (Cloudflare’s S3 alternative) to reduce the amount of requests to your origin and keep items in cache longer: Cache Reserve · Cloudflare Cache (CDN) docs

Both normal cache and cache reserve use the normal CF-Cache-Status header for cache status (i.e hit/miss/etc).

Videos may be too big to be cached in either normal cache or cache reserve, the max per file size for Free/Pro/Business plans is 512 MB.

2 Likes

Thank you very much for your answer.
if use the normal cache, how much the cache size and the time limit?

After reading the documentation, I understood that if the origin server http return normal, then set the ttl valid, if the http link is invalid, set the ttl invalid, and release the cache. Is that correct?

If I set always online, the origin cache on the cdn node will be available forever. There is no time limit.Is that correct?

  • Thank you for your patient answer :kissing_heart:
1 Like

In addition, if I subscribe to your R2 storage function to store the video, link R2 store the video file url when our source server plays the video, and then the cdn will store an additional copy on the lower node?

The limit for max per file cache size is 512 MB for Free/Pro/Business, and starting at 5 GB for Enterprise.

There is minimum Cache TTLs depending on the plan, but no maximum: Edge and Browser Cache TTL · Cloudflare Cache (CDN) docs

There is no guarantee your asset will stay in cache for the amount of time you specify though, it will very likely be evicted before then, due to infrequency of access or something else. The TTL you specify is just a max not a guarantee.

There is no max amount of files or overall total max size, but again your assets will just be evicted from cache if they’re not frequently requested.

A bit more complex then that, status codes are a factor though.
Default Cache Behavior · Cloudflare Cache (CDN) docs goes over the default behavior and cached extensions, which can be overridden with a page or cache rule.

i.e respond with a cache-control or expires header that allows it to be cached greater then the min. cache ttl for your plan, or with a status code that allows it to be cached (Cache by status code · Cloudflare Cache (CDN) docs) and for both, the asset would also need to be one of the default cached extensions.

Again, this is default behavior and can be overridden with cache/page rules.

Always Online is a feature in partnership with Internet Archive with only activates under specific error status codes and is not as fast if it was actually cached on edge.

In general, Cloudflare will never hold your file at every edge unless you have very high request rate. Cloudflare has some 350+ locations, some of them multi-colo (made up of several datacenters), which have their own cache. There’s just not enough space to hold everyone’s assets forever, Cloudflare’s caches are LRU, cycling assets in and out and evicting the least recently used. If it is important for you to avoid requests to your origin (real web server) as much as possible, Cloudflare offers Tiered Caching (which picks a upper tier cloudflare location closest to your origin which all other locations check cache first, before going to origin) or Cache Reserve (using R2 to cache assets for longer, min of 10 hours cache ttl among a few other restrictions), to help reduce origin traffic.

R2 stores your file in one location, by default the closest R2 location to you when you created the bucket, and then if you used a Custom Domain, it could then be cached like normally.

R2 Custom Domains are still subject to the normal cache limits, so if it’s over 512 MB unless you’re Enterprise, it will be requested from R2’s Origin (the single location your file is in)

2 Likes

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