WORKS 10 1. Client request file 2. If file in cache CF return file Nearest Edge Location a. If file not in cache, CloudFront request to origin b. Origin returns latest version of file, status 200, cached in CloudFront 1. Client request file 2. If file in cache CF return file Nearest Edge Location a. If file in cache but expired, CloudFront request to origin b. Cached file is latest, status 304, CloudFront keeps file in cache, No change in Date, Expire Refreshed Age Condition GET Routing based on low latency/price class 01
Origin Servers per CF Distribution 2. 10 Cache Behavior per CF Distribution 3. 10 CNAME per CF Distribution 4. 10 Cookies forwarded per Cache Behavior 11 01 MAKE A NOTE
USING FILE CONTENT B723EH0F0DF PROFILE.PNG UPLOAD TO S3 USE HASH AS FILE NAME STATIC/IMAGES/B723EH0F0DF.PNG CF KEY STATIC/IMAGES/B723EH0F0DF.PNG FOR S3 CONTENT 23 Avoid content duplication
using prefix/suffix File name with version prefix/suffix: /static/profile_123.png File name with version prefix/suffix: /static/profile_ 712vds57tr18929812312enb.png VERSIONING 25
expiration 24hrs Set Cache-Control max-age or Minimum TTL very far future max {Cache-Control max-age directive, Cache Behavior Minimum TTL} EXPIRATION 34
Expire header After expiry browser cachability issues (stale response) Can not cache object if {Age <=0 OR Expire Date - Current Date <=0} EXPIRATION 36
across 2 CNAME aliases will double the parallel download DOMAIN SHARDING 39 Client Browser CNAME2 ->Server time -> GET 200 OK GET 200 OK X n Client Browser CNAME1 ->Server time -> GET 200 OK GET 200 OK X n
out for the object paths /video/uploads/, /audio/uploads/, /images/uploads/ BAD /uploads/video/, /uploads/audio/, /uploads/image/ GOOD Use wild card patterns (/uploads/*) BUCKET ORGANISATION 44
Testing (Edge Location, EIP) 1.Multiple Client from different geolocations 2.Independent DNS request, different set of IPs 3.Distribute load across set of IPs PERFORMANCE TESTING 53