How does the "Optimize for media files" setting work?

By default, BunnyCDN caches each URL with a single cache key under a single file. When delivering large files that require random read access, this can be very inefficient. Until a file is fully cached, it is also not possible to efficiently perform Range requests, so if a user requests the end part of the video only, the full video will need to be downloaded and cached from your origin.

What enabling the "Optimizer for media files" feature does is that it splits and caches each URL into many small independent chunks. The chunks are only requested from your origin when required which improves the caching efficiency. It also allows requesting each part of the file at any time if cached or uncached, meaning users can efficiently skip through a video without the need for the whole file to be cached.

To the end-user, this works completely transparently and the system automatically combines all the cached and or uncached chunks.

However, the system can cause issues if the file changes on the origin and some of the chunks are already in cache which can then result in cache corruption. We recommend that when the optimizer for media files feature is active, the files are not changed and instead use a different file name if possible or that you always fire a purge request for any URL that changes to avoid delivery issues.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.