Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 296
Joined: 01 Mar 2011, 11:13

very low cache hit ratio with a CDN

11 Jul 2019, 15:52

Hello, I've used in the past CDN77 and in the gallery I've always had a very low cache hit percentage ratio. Just switched to Bunny CDN and the cache hit percentage is always very low as you can see in the attachment.
In the forum (xenforo) and site (wordpress), I'm over 80% but in the gallery I'm barely over 20%.
Can someone explain me why? In my gallery I've files back from 2001 and there always the same since I update the gallery 2 or 3 times a month to add new galleries.
Screenshot 2019-07-11 21.51.58.png
Screenshot 2019-07-11 21.51.58.png (102.61 KiB) Viewed 32 times
Screenshot 2019-07-11 21.51.27.png
Screenshot 2019-07-11 21.51.27.png (237 KiB) Viewed 32 times
 
User avatar
mjau-mjau
X3 Wizard
Posts: 11659
Joined: 30 Sep 2006, 03:37

Re: very low cache hit ratio with a CDN

12 Jul 2019, 11:38

Really, you need to ask your CDN about this. For example, your CDN service might only retain cache on a specific edge for a month (or more, or less), unless it is re-requested. Also, how many EDGE cache servers do they have? If they have 12 server for example, 12 requests from different locations, might not yield cache result. For example, Cloudflare CDN (although it doesn't work exactly like other CDN's) have more hundreds of edge servers ... They will only store data on an edge server for a certain amount of time, until it gets removed from server, as it's considered outdated.

Perhaps your low yield results are for something that shouldn't get cached? Hard to say. Most important is that it caches images for a long time.

The only thing you can do is start reviewing headers. Here is a raw image served by X3:
https://gallery.kog.it/content/2.200120 ... 0901/1.jpg

Let's check the response headers:
Image
X3 is definitely serving the correct cache headers that you want:
X3 response headers wrote:cache-control: max-age=315360000
expires: Mon, 09 Jul 2029 15:26:27 GMT
last-modified: Mon, 13 Apr 2015 11:23:26 GMT
Now, your CDN will "pull" images from the above, and should inherit the headers, unless you overwrite them from your CDN settings. Here is the same image from CDN:
https://kgallery.b-cdn.net/content/2.20 ... 0901/1.jpg

You would have to try to load that image from multiple locations every, for example using https://www.webpagetest.org/, and checking if you get HIT response or not for all. If not, it is emptying the cache, but for what reason? Only your CDN provider can answer that.
 
User avatar
andreamarucci
Experienced
Topic Author
Posts: 296
Joined: 01 Mar 2011, 11:13

Re: very low cache hit ratio with a CDN

14 Jul 2019, 16:35

Ok I'll ask for this, thanks for the clear explanation...