Bunny CDN perma cache

@GulshanKumar

I am experimenting with closte litespeed server + litespeed cache and working really well.
Also, with this site, i am trying everything completely opposite to my existing website. Just to see what the heck happens!

Ever used Bunnycdn perma cache and hows the experience? I have heard about bunny optimizer but i dont wanna spend $10 on it right now. Let me know ur thoughts on perma cache.

A user from :india: send a HTTP request for /logo.png, assume below thing happens

08:45 PM 09-January-2021 A user sent request for /logo.png == cdn-cache: MISS
08:47 PM 09-January-2021 Another user sent request for /logo.png == cdn-cache: HIT
08:48 PM 09-January-2021 Another user sent request for /logo.png == cdn-cache: HIT
08:49 PM 09-January-2021 Another user sent request for /logo.png == cdn-cache: HIT

After two weeks. (File got erased from :india: datacenter because less visits). :fearful:

08:46 PM 23-January-2021 Another user sent request for /logo.png == cdn-cache: MISS

Without Perma Cache -

  • Again, Bunny have to contact WordPress origin server (hosting) to fetch file.

  • Hey origin, assuming you’re online, Send me /logo.png to serve MISS response and cache in DC

Then, request will flow like this until frequently accessed time frame…

    08:45 PM 23-January-2021 A user sent request for /logo.png == cdn-cache: MISS 
    08:46 PM 23-January-2021 A user sent request for /logo.png == cdn-cache: HIT
    08:47 PM 23-January-2021 A user sent request for /logo.png == cdn-cache: HIT
    08:48 PM 23-January-2021 A user sent request for /logo.png == cdn-cache: HIT
    08:49 PM 23-January-2021 A user sent request for /logo.png == cdn-cache: HIT

A week later… when cache is expired and origin is down.

01:12 AM 15-January-2021 Another user sent request for /logo.png 

Without Perma cache, It will return error 5XX depending on request type.


Introducing Perma Cache

A permanent caching system that avoid multiple contact to origin act as intermediary. It’s like, a middle man has Xerox copy of origin’s file to fulfill request :slight_smile:

So… now either origin remain up or down after first HTTP request (MISS), perma cache has its copy to serve all future requests until ‘purge’ regardless of origin server condition.

08:49 PM 24-January-2021 Another user sent request for /logo.png == cdn-cache: MISS, Perma-Cache: HIT
08:50 PM 24-January-2021 Another user sent request for /logo.png == cdn-cache: HIT
08:51 PM 24-January-2021 Another user sent request for /logo.png == cdn-cache: HIT

As a result…

  • It’s not only that… Perma Cache is geo-replicated. The main storage should be nearest to your origin for good result… and it will replicate files in other available regions (as per your selections)

  • So, all these together makes file all time available and reduces pull request to origin.

  • It is useful for ‘static files’ in my opinion, especially for S3 users where origin bandwidth cost is high.

  • The Perma cache is bigger version of free Origin Shield feature with geo-replication. Currently, it is supported for ‘GET’ request only which is sufficient for most users.

  • A single URL can have multiple Content-Type such as image/jpeg or image/webp, Bunny can serve varied response based on Request Header of visitor browser when Perma Cache is enabled.

For WebP, you can use WebP Express plugin with Vary cache mode at BunnyCDN.

image

3 Likes

So i think its overall positive. Especially for sites with lot of images. Thats what i am thinking too.

Although most sites rely on CF i feel the value contributed by CF too good to be true. Free CDN delivering all your files for u. Although i know thats their value proposition, i find it too good.

So in this site i am not gonna go CF route at all. Will use litespeed + bunny + wp rocket this perma cache thing. If money starts coming, will use bunny optimizer on top of it. Hopefully this should easily get me through. WP rocket is truly the cherry on top.

Tell me one thing. I thought that max-age: 1 month means that the files are stored in the individual CDN datacenter for 1 month. Is that a wrong thinking then?

What does max-age drive then? Only caching in browser? Or also on CDN edge.

Only possible if file is accessed frequently within 30 days else hardly few weeks is enough then it will get erased. Some CDN even expire in matter of few hours depending on plan, It will again fetch from your hosting server. Or Cloud Storage (ONLY If perma cache is enabled).

In my experience, Bunny still hold for quite long compared to other CDN.

1 Like