Force AWS CloudFront to refresh resources from origin without user requests

amazon-cloudfrontamazon-web-servicescachecdn

I'm deploying a CloudFront distribution for a widely distributed network. I'm using my own server as origin and I've configured the cache expiration to a custom value (say 24 hours). Everything works smooth for the edges used by the countries that generates high traffic and for the resources that are requested more often, but I think the same is not true for a (big) part of the requests which are originated by countries with low traffic.

Since the network have several tens of thousands of resources and, given the organic (long tail) nature of the traffic most of them are accessed just 3-4 times per day per edge. In that case, if my understanding is correct, the first request has bad performances (it is fetched from the origin) while the remaining 2-3 benefits from cloud front. In this scenario roughly 30% of the traffic is not using any CDN caching.

Is there a way to force the edges to autonomously refresh a set of objects regardless of the users requesting them in order to keep them "ready"? I know there'll be an impact on the monthly bill but for the moment I'm focusing on performances so let's assume costs are not important here.

Best Answer

If I read correctly, you want to pre-warm cache. There is no official way to pre-warm cache.

However, you can use list from http://blog.domenech.org/2013/10/amazon-web-services-cloudfront-edgelocation-codes.html to pre-warm.

For d709c28ax59vf.cloudfront.net, it will be:

  • d709c28ax59vf.ams1.cloudfront.net
  • d709c28ax59vf.ams50.cloudfront.net
  • ...

You can write a script to pre-warm these domain with Host: d709c28ax59vf.cloudfront.net header.

Related Topic