Search code examples
amazon-web-servicesazuregoogle-cloud-platformamazon-cloudfrontcdn

Do CDN such as cloudfront have any limitation to maximum volume of cache that can be stored in a distribution?


I am trying to understand the pricing of CDN in AWS, GCP and Azure.

One thing I am not able to figure out is, if there is any limit to total amount of cache which can be stored in a single distribution, and is there any added cost as the total volume of cache keeps on increasing.

To give my prospective:-

Usecase 1) Using CDN for delivering 1_000_000 files of size 100KB in a location daily, with retention time of 1day.

Total Volume of data present in cache (1year later): 1_00_000 * 100KB * 1 = 100GB

Total Bandwidth consumed (1year later): 1_000_000 * 100KB * 365 = 3650GB

Usercase 2) Using CDN for delivering 100 files of size 100MB in a location daily, with retention time of 1years.

Total Volume of data present in cache (1year later): 100 * 100MB * 365 = 3650GB

Total Bandwidth consumed (1year later): 100 * 100MB * 365 = 3650GB

(Note: Let's assume in the use case above all the files counted are always unique.)

So speaking of cloudfront, it will mainly charging me for the bandwidth, which is same for both the use cases. However in Usecase 2 the resources spent for storing the cache is a lot higher.

My question is am I missing something in the pricing, or CDN providers don't care about storage costs?


Solution

  • Regarding CloudFront. Cache size is virtually unlimited and you pay for it with transfer fees. The fact that you set "retention time of 1years" does not mean your files will stay in cache for that long. If AWS deems your files as in-frequently used, it will purge them well before they get 1 year old. From docs:

    If a file in an edge location isn't frequently requested, CloudFront might evict the file—remove the file before its expiration date—to make room for files that have been requested more recently.