I am a bit new to the world of CDN's. I am also running an internationa site, which we hope will one day have a lot of traffic, but for now trickles in. Site uses a image resizer behind a CDN to serve most images.

The problem is that we get a lot of misses from the Cloudfront (Around 25%), and it is not clear to me why - Since there are no new photos or new sizes, I thought origin should almost never be called.

In the beginning origin did not send expiry time, and on Apr 8, I added a week expiry with no effect.

Why is origin queried so often?

enter image description here

  • 2
    CloudFront has many, many servers, and if your data isn't accessed too often the files can be removed to make room for other files. Some of your requests will hit origin no matter what you do. – ceejayoz Apr 12 '15 at 20:14

First, I'm assuming you have a custom origin, and that it's a web server like nginx that serves the files with a setting like "expires 1w". Also know that the amount of traffic you receive could also effect the ratio of hits to misses.

For starters, you need to see how Cloudfront sees your objects as they are served from your origin. I use Chrome Devtools to load an object and view the headers (F12, reload the browser, click Network tab, click the asset, look at the Headers sub-tab). You may see something like this, which I've trimmed to the relevant fields:

Age: 1091
Date:Thu, 10 Jul 2015 19:35:35 GMT
Expires:Thu, 17 Jul 2015 19:35:35 GMT
Last-Modified:Tue, 16 Jun 2015 18:00:59 GMT
X-Cache:Miss from cloudfront

Something like the above would mean Cloudfront is checking every week for new content, which is what you want. But if you see a different max-age, or a longer or shorter date range between for Date and Expires, then Cloudfront is checking via a different schedule, and that could result in more calls back to your origin.

If this is the case, my first idea is that you said you originally had a different expire time, but you then changed it to one week. I believe that if you change the expire time on your origin, but you don't at least 'touch' your files to update their modified date, Cloudfront will not update with your new expires time. You could go set it to 1 Year, but if the assets are still the same as before, Cloudfront will continue to check them on whatever expires they were when they initially were loaded.


It's basically says you're competing for edge resources with other websites. Free space on edge is limited and less frequently accessed content gets wiped out of the edge cache. Your number are quite good actually. We see about 70% miss-rate in US.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.