At bunny.net, Perma-Cache offers a robust solution to enhance your site's performance by reducing the load on your origin server through a permanent secondary caching layer. Therefore, with Perma-Cache enabled, you no longer need to worry about the effects of low cache hit rates. Our simple one-click solution takes care of this for you.
What you’ll need
Before you dive in, make sure you have the following prerequisites in place:
- A bunny.net account (Log in or sign up for a free trial).
- A pull zone must be created and configured, pointing to the Origin URL of your site. Refer to our pull zone creation guide for detailed instructions.
- A storage zone must be established to host your Perma-Cache. This storage zone must be linked to the pull zone you created.
How Perma-Cache works
Perma-Cache functions by placing a secondary, permanent caching layer between our CDN and your origin server. Here’s how it works:
- When a Cache Miss occurs (i.e., the requested file is not in the CDN cache), the CDN queries the Perma-Cache storage.
- If the file is available in the Perma-Cache, it is served directly from there, alleviating the load on your origin.
- If Perma-Cache does not contain the file, the CDN immediately forwards the request to your origin server to retrieve the file. Meanwhile, Perma-Cache starts caching the file from your origin to our storage in the background. This efficient background process ensures no additional latency affects file delivery.
- After caching the file, Perma-Cache replicates it across our global storage network to enhance data reliability and availability without impacting the performance of your origin server. Note that this replication only occurs if geo-replication is enabled.
NOTE: Files are globally available if geo-replication is enabled and are replicated across our global storage network to enhance data reliability and availability.
WARNING: Don't use Perma-Cache as an alternative for offloading files indefinitely. Files should remain on the origin as purging the cache will cause Perma-Cache to re-fetch from the origin, which will no longer exist.
Purging Perma-Cache
WARNING: Wildcard and purge via tags do not work when Perma-Cache is enabled.
Perma-Cache integrates with our file-purging API in the following ways:
- Individual file purge: When a URL is purged, the file is first deleted from the Perma-Cache and then from the CDN cache.
- Full pull zone purge: In a complete purge, the Perma-Cache retains the files but shifts to a new directory structure within the storage zone. If needed, you must manually delete the old cache folder.
Integrating Perma-Cache with your site
To integrate Perma-Cache, follow the steps below:
- Click on CDN and select your newly created Pull Zone.
- Click on Caching, select Perma-Cache, and select your new Storage Zone from the drop-down menu.
- Click Save Configuration.
Your site is now successfully configured with our Perma-Cache feature, and you will soon begin to see the size of the Perma-Cache increase.
NOTE: A quick way to check if everything is working as intended is to check the headers on one of the requests delivered by our CDN. There should be a new header called Perma-Cache, and its status will be either a miss or hit. For more information, see the CDN-Cache and Perma-Cache headers explained.
If you cannot see or enable Perma-Cache, ensure you are not using Origin Shield simultaneously, as these features are mutually exclusive. If your pull zone is directly connected to our storage, the Perma-Cache feature will not be available because you are already hosting your content on our storage.
Need help or encountering issues?
If you encounter any difficulties or have questions while following this Quickstart Guide, our support team is here to assist you. Please don't hesitate to contact us via the support request form for prompt assistance.
Our dedicated support team is ready to help you resolve any issues you might face during the deployment process, provide additional guidance, or answer your questions.