Search code examples
amazon-web-servicesamazon-s3cdnamazon-cloudfront

Lower latency from CDN but increased download time?


I am using S3 and Cloudfront I have tested accessing two identical images, one from S3 and one from Cloudfront and the results are :

results

Also : https://i.sstatic.net/pmiIn.png

First image file is from S3 and the second one is from cloudfront. As you can see,

  • On S3 accessing the file takes 132 ms and downloading takes 102 ms overall 234 ms
  • On Cloudfront accessing the file takes 93 ms and downloading takes 258 ms overall 351 ms.

Isn't CDN suppose to lower the latency overall and improve performance ? Why is the download time so much slower ?


Solution

  • Looking at overall performance across all networks a CDN will be faster than downloading the file from s3. However, that may not be true for every single user. It ultimately depends on what networks the user is connecting from, what CDN endpoint they get sent to, and other network conditions.