Upload
abhishek-tiwari
View
4.575
Download
1
Tags:
Embed Size (px)
DESCRIPTION
CloudFront is a Content Delivery Network (CDN) provided by Amazon Web Services (AWS). It integrates seamlessly with other AWS services. Agenda of this presentation is 1. CloudFront OVERVIEW 2. CloudFront BEST PRACTICES & ANTI-PATTERNS This presentation was prepared for AWS Sydney Meetup.
Citation preview
CloudFront BEST PRACTICES & ANTI-PATTERNS
Abhishek Tiwari@abhishektiwari
http://abhishek-tiwari.com
Wednesday, 7 August 13
About me
Wednesday, 7 August 13
About me
Solutions Architect
Wednesday, 7 August 13
About me
Solutions Architect Early AWS adopter (2007)
Wednesday, 7 August 13
About me
Solutions Architect Early AWS adopter (2007)Built Cotton On Group’s AWS Infrastructure (2012)
Wednesday, 7 August 13
Agenda
CloudFront in a nutshellCloudFront Best Practices/Anti-Patterns
Wednesday, 7 August 13
CloudFront (CF)
Wednesday, 7 August 13
CloudFront (CF)Content Delivery Network
Wednesday, 7 August 13
CloudFront (CF)Content Delivery NetworkServes Static and Dynamic Content
Wednesday, 7 August 13
CloudFront (CF)Content Delivery NetworkServes Static and Dynamic ContentGlobal, Redundant, Scalable
Wednesday, 7 August 13
CloudFront (CF)Content Delivery NetworkServes Static and Dynamic ContentGlobal, Redundant, ScalableLow Latency, High Bandwidth
Wednesday, 7 August 13
CloudFront (CF)Content Delivery NetworkServes Static and Dynamic ContentGlobal, Redundant, ScalableLow Latency, High BandwidthCost Effective: Transparent, PAYG, Price Classes
Wednesday, 7 August 13
CloudFront (CF)Content Delivery NetworkServes Static and Dynamic ContentGlobal, Redundant, ScalableLow Latency, High BandwidthCost Effective: Transparent, PAYG, Price ClassesNO Edge Side Includes (ESI)
Wednesday, 7 August 13
CF Concepts
Wednesday, 7 August 13
CF ConceptsDistribution
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Object/s (Object Path/Cache Key)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Object/s (Object Path/Cache Key)
Cache Behavior/s (1-10, 1:1, Ordered)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Object/s (Object Path/Cache Key)
Cache Behavior/s (1-10, 1:1, Ordered)
Path Patterns, Origin ID, Viewer Protocol, Minimum TTL, Cookies/Query String Forwarding
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Object/s (Object Path/Cache Key)
Cache Behavior/s (1-10, 1:1, Ordered)
Path Patterns, Origin ID, Viewer Protocol, Minimum TTL, Cookies/Query String Forwarding
Edge Location (42+)
Wednesday, 7 August 13
CF ConceptsDistribution
Delivery Method (Download or Streaming)
CNAME Aliases (1-10)
Origin Server/s (M:M)
Domain Name, Origin ID, Origin Protocol
Object/s (Object Path/Cache Key)
Cache Behavior/s (1-10, 1:1, Ordered)
Path Patterns, Origin ID, Viewer Protocol, Minimum TTL, Cookies/Query String Forwarding
Edge Location (42+)
Viewer (GET, Range GET, HEAD Requests)Wednesday, 7 August 13
CF Concepts
http://mycontent.cloudfront.net/photos/profile.pngCache Key: photos/profile.png (Same for HTTP/HTTPS)
Cache Key: object path relative to origin + forwarded query string/cookies
Wednesday, 7 August 13
CF Concepts
Dynamic Content
http://mycontent.cloudfront.net/photos/profile.pngCache Key: photos/profile.png (Same for HTTP/HTTPS)
Cache Key: object path relative to origin + forwarded query string/cookies
Wednesday, 7 August 13
CF Concepts
Dynamic Content
Static Content
http://mycontent.cloudfront.net/photos/profile.pngCache Key: photos/profile.png (Same for HTTP/HTTPS)
Cache Key: object path relative to origin + forwarded query string/cookies
Wednesday, 7 August 13
How it works1. Client request file
2. If file in cache CF return fileNearest Edge
Location
a. If file not in cache, CF request to origin
b. Origin returns file, status 200, cached in CF
1. Client request file
2. If file in cache CF return fileNearest Edge
Location
a. If file in cache but expired, CF request to origin
b. Origin returns 304, CF keeps file in cache
Routing based on low latency/price class
Routing based on low latency/price class
Condition GET
Wednesday, 7 August 13
Distribution
Wednesday, 7 August 13
DistributionDownload Distribution
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPS
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or Custom
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or CustomCookies/Query String Forwarding
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or CustomCookies/Query String Forwarding
Streaming Distribution
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or CustomCookies/Query String Forwarding
Streaming DistributionViewer Protocol: Adobe RTMP
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or CustomCookies/Query String Forwarding
Streaming DistributionViewer Protocol: Adobe RTMPOrigin: S3 only (No Custom)
Wednesday, 7 August 13
DistributionDownload Distribution
Viewer Protocol HTTP/HTTPSOrigin: S3 or CustomCookies/Query String Forwarding
Streaming DistributionViewer Protocol: Adobe RTMPOrigin: S3 only (No Custom)Dynamic/Adoptive Streaming (Adjust bit rate during playback)
Wednesday, 7 August 13
Query String Forwarding
Wednesday, 7 August 13
Query String ForwardingForward query string to origin
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitive
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
http://d111111abcdef8.cloudfront.net/images/image.jpg?height=a&width=b
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
http://d111111abcdef8.cloudfront.net/images/image.jpg?height=a&width=b
http://d111111abcdef8.cloudfront.net/images/image.jpg?width=b&height=a
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
http://d111111abcdef8.cloudfront.net/images/image.jpg?height=a&width=b
http://d111111abcdef8.cloudfront.net/images/image.jpg?width=b&height=a
Case sensitive: Two objects in CF
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
http://d111111abcdef8.cloudfront.net/images/image.jpg?height=a&width=b
http://d111111abcdef8.cloudfront.net/images/image.jpg?width=b&height=a
Case sensitive: Two objects in CFhttp://d111111abcdef8.cloudfront.net/images/image.jpg?type=png
Wednesday, 7 August 13
Query String ForwardingForward query string to originMultiple parameters, order/case sensitiveOrder sensitive: Two objects in CF
http://d111111abcdef8.cloudfront.net/images/image.jpg?height=a&width=b
http://d111111abcdef8.cloudfront.net/images/image.jpg?width=b&height=a
Case sensitive: Two objects in CFhttp://d111111abcdef8.cloudfront.net/images/image.jpg?type=png
http://d111111abcdef8.cloudfront.net/images/image.jpg?type=PNG
Wednesday, 7 August 13
Cookies Forwarding
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributes
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributesIf choose to forward cookies to origin,
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributesIf choose to forward cookies to origin,
Can forward all cookies, OR
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributesIf choose to forward cookies to origin,
Can forward all cookies, OROnly specified cookies
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributesIf choose to forward cookies to origin,
Can forward all cookies, OROnly specified cookies
Object path+FC uniquely identify in CF
Wednesday, 7 August 13
Cookies ForwardingForwarded cookies (FC): NV pairs, not attributesIf choose to forward cookies to origin,
Can forward all cookies, OROnly specified cookies
Object path+FC uniquely identify in CFNV pair/Case sensitive
Wednesday, 7 August 13
Origin
Wednesday, 7 August 13
OriginS3 Origin: Best for Static media content (Image, Video, Audio)
Wednesday, 7 August 13
OriginS3 Origin: Best for Static media content (Image, Video, Audio)Custom Origin: Best for Static application content (JS, CSS, Fonts)
Wednesday, 7 August 13
OriginS3 Origin: Best for Static media content (Image, Video, Audio)Custom Origin: Best for Static application content (JS, CSS, Fonts)Custom Origin: Best for Dynamic media content (HTML, Thumbnails)
Wednesday, 7 August 13
Make a note
Wednesday, 7 August 13
Make a note
Eventual Consistency
Wednesday, 7 August 13
Make a note
Eventual Consistency10 Origin Servers per CF Distribution
Wednesday, 7 August 13
Make a note
Eventual Consistency10 Origin Servers per CF Distribution10 Cache Behavior per CF Distribution
Wednesday, 7 August 13
Make a note
Eventual Consistency10 Origin Servers per CF Distribution10 Cache Behavior per CF Distribution10 CNAME per CF Distribution
Wednesday, 7 August 13
Make a note
Eventual Consistency10 Origin Servers per CF Distribution10 Cache Behavior per CF Distribution10 CNAME per CF Distribution10 Cookies forwarded per Cache Behavior
Wednesday, 7 August 13
Best Practices
Wednesday, 7 August 13
Best PracticesVersioning
Wednesday, 7 August 13
Best PracticesVersioningCompression
Wednesday, 7 August 13
Best PracticesVersioningCompressionDomain Sharding
Wednesday, 7 August 13
Best PracticesVersioningCompressionDomain ShardingExpiration
Wednesday, 7 August 13
Best PracticesVersioningCompressionDomain ShardingExpirationBucket Organization
Wednesday, 7 August 13
Best PracticesVersioningCompressionDomain ShardingExpirationBucket OrganizationLogging
Wednesday, 7 August 13
Best PracticesVersioningCompressionDomain ShardingExpirationBucket OrganizationLoggingPerformance Testing
Wednesday, 7 August 13
Anti-Patterns
Cache Invalidation
Wednesday, 7 August 13
Cache Invalidation
Wednesday, 7 August 13
Cache Invalidation
Programmatic Cache Invalidation
Wednesday, 7 August 13
Cache Invalidation
Programmatic Cache InvalidationCache Invalidation is expensive
Wednesday, 7 August 13
Cache Invalidation
Programmatic Cache InvalidationCache Invalidation is expensive Unmanageable if you have object dependencies
Wednesday, 7 August 13
Cache Invalidation
Programmatic Cache InvalidationCache Invalidation is expensive Unmanageable if you have object dependencies3 invalidation requests at any given time
Wednesday, 7 August 13
Cache Invalidation
Programmatic Cache InvalidationCache Invalidation is expensive Unmanageable if you have object dependencies3 invalidation requests at any given timeEach invalidation request can included maximum of 1000 files
Wednesday, 7 August 13
Cache Invalidation
Wednesday, 7 August 13
Cache Invalidation
Invalidation takes time to propagate across all edge locations (5-15 minutes)
Wednesday, 7 August 13
Cache Invalidation
Invalidation takes time to propagate across all edge locations (5-15 minutes)Deal breaker: browser cache
Wednesday, 7 August 13
Cache Invalidation
Invalidation takes time to propagate across all edge locations (5-15 minutes)Deal breaker: browser cacheVersioning is best way to avoid the invalidation related issues
Wednesday, 7 August 13
Versioning
Wednesday, 7 August 13
Versioning
CF relies on Origin Servers for versioning
Wednesday, 7 August 13
Versioning
CF relies on Origin Servers for versioningS3 supports versioning
Wednesday, 7 August 13
Versioning
CF relies on Origin Servers for versioningS3 supports versioningVersion enabled Custom Origin
Wednesday, 7 August 13
Versioning
Wednesday, 7 August 13
VersioningVersioning using query strings
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash key
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash keyFile name as unique key based on file content /static/712vds57tr18929812312enb.png
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash keyFile name as unique key based on file content /static/712vds57tr18929812312enb.png
Versioning using prefix/suffix
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash keyFile name as unique key based on file content /static/712vds57tr18929812312enb.png
Versioning using prefix/suffixFile name with version prefix/suffix /static/profile_123.png
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash keyFile name as unique key based on file content /static/712vds57tr18929812312enb.png
Versioning using prefix/suffixFile name with version prefix/suffix /static/profile_123.png
File name with version prefix/suffix /static/profile_ 712vds57tr18929812312enb.png
Wednesday, 7 August 13
VersioningVersioning using query strings
File name plus query string with version /static/profile.png?versionID=123
Versioning using content based hash keyFile name as unique key based on file content /static/712vds57tr18929812312enb.png
Versioning using prefix/suffixFile name with version prefix/suffix /static/profile_123.png
File name with version prefix/suffix /static/profile_ 712vds57tr18929812312enb.png
You can use a mixed versioning approachWednesday, 7 August 13
Versioning using query strings
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwarding
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
profile.png
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
profile.png Upload to S3
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
profile.png Upload to S3 static/images/profile.png
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
profile.png Upload to S3 static/images/profile.png Return x-amz-version-id
Wednesday, 7 August 13
Versioning using query strings
CF supports versioning using query strings forwardingVersioning enabled Origin (Custom/S3)For S3 Content
On object upload version enabled S3 bucket will return x-amz-version-id
profile.png Upload to S3 static/images/profile.png Return x-amz-version-id static/images/profile.png?versionId=644c69e148
Wednesday, 7 August 13
Versioning using query strings
Wednesday, 7 August 13
Versioning using query strings
Versionify Application content
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
photo.css, app.css, profile.cssphoto.js, app.js, profile.js
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js Versionify
Wednesday, 7 August 13
Versioning using query strings
Versionify Application contentUse Build Number or Hash of GIT/HG Head
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js Versionify main.css?v=468df6bmain.js?v=468df6b
Wednesday, 7 August 13
Versioning using query strings
Wednesday, 7 August 13
Versioning using content based hash key
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for file
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
profile.jpg
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
profile.jpg MD5 Hash File Name
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
profile.jpg MD5 Hash File Name b723eh0f0df.png
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
profile.jpg MD5 Hash File Name b723eh0f0df.png Upload to S3
Wednesday, 7 August 13
Versioning using content based hash key
File name is an unique hash key generated from file content (MD5)For S3 content
Before uploading to S3 generate MD5 hash for fileUse hash as file name to upload on S3Avoid content duplication by comparing MD5 hashes
profile.jpg MD5 Hash File Name b723eh0f0df.png Upload to S3 static/images/b723eh0f0df.png
Wednesday, 7 August 13
Versioning using content based hash key
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipeline
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
photo.css, app.css, profile.cssphoto.js, app.js, profile.js
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js MD5 Hash File Name
Wednesday, 7 August 13
Versioning using content based hash key
For application content use a pipelinefile names generated using MD5 hash of file content
photo.css, app.css, profile.cssphoto.js, app.js, profile.js Minify+Combine main.css
main.js MD5 Hash File Name 8972bw7dyf2h.css67bfwu9hhuw.js
Wednesday, 7 August 13
Versioning using content based hash key
Wednesday, 7 August 13
Compression
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidth
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidthCF can serve both compressed and uncompressed version of files
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidthCF can serve both compressed and uncompressed version of filesDepends on viewer or browser request
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidthCF can serve both compressed and uncompressed version of filesDepends on viewer or browser request
To receive compressed content browser must include Accept-Encoding: gzip in the request header
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidthCF can serve both compressed and uncompressed version of filesDepends on viewer or browser request
To receive compressed content browser must include Accept-Encoding: gzip in the request header
For compression CF relies on the custom origin servers
Wednesday, 7 August 13
CompressionCompressed content is served faster and uses less bandwidthCF can serve both compressed and uncompressed version of filesDepends on viewer or browser request
To receive compressed content browser must include Accept-Encoding: gzip in the request header
For compression CF relies on the custom origin serversS3 does not perform the compression
Wednesday, 7 August 13
Compression
Wednesday, 7 August 13
CompressionS3 can store both gzip and non-gzip versions of the file in the same bucket
Wednesday, 7 August 13
CompressionS3 can store both gzip and non-gzip versions of the file in the same bucketWhen uploading gzip file to Amazon S3 set Content-Encoding to gzip
Wednesday, 7 August 13
CompressionS3 can store both gzip and non-gzip versions of the file in the same bucketWhen uploading gzip file to Amazon S3 set Content-Encoding to gzipOn-the-fly compression by custom origin server (Nginx, Apache)
Wednesday, 7 August 13
CompressionS3 can store both gzip and non-gzip versions of the file in the same bucketWhen uploading gzip file to Amazon S3 set Content-Encoding to gzipOn-the-fly compression by custom origin server (Nginx, Apache)Compress: HTML, CSS, JS etc
Wednesday, 7 August 13
CompressionS3 can store both gzip and non-gzip versions of the file in the same bucketWhen uploading gzip file to Amazon S3 set Content-Encoding to gzipOn-the-fly compression by custom origin server (Nginx, Apache)Compress: HTML, CSS, JS etcCompress Image: JPEG, WebP (Q= 0-100)
Wednesday, 7 August 13
Expiration
Wednesday, 7 August 13
ExpirationUse one/both of these
Wednesday, 7 August 13
ExpirationUse one/both of these
On Origin server set Cache-Control max-age header
Wednesday, 7 August 13
ExpirationUse one/both of these
On Origin server set Cache-Control max-age headerIn Cache Behavior set Minimum TTL
Wednesday, 7 August 13
ExpirationUse one/both of these
On Origin server set Cache-Control max-age headerIn Cache Behavior set Minimum TTL
Date header/Age header (RFC 2616)
Wednesday, 7 August 13
ExpirationUse one/both of these
On Origin server set Cache-Control max-age headerIn Cache Behavior set Minimum TTL
Date header/Age header (RFC 2616)Avoid Expire header
Wednesday, 7 August 13
Expiration
Wednesday, 7 August 13
ExpirationBrowser cachability issues (known bug)
Wednesday, 7 August 13
ExpirationBrowser cachability issues (known bug)Set Cache-Control max-age or Minimum TTL very far future
Wednesday, 7 August 13
ExpirationBrowser cachability issues (known bug)Set Cache-Control max-age or Minimum TTL very far futureDepending on request frequency, CloudFront might remove the object before its expiration
Wednesday, 7 August 13
ExpirationBrowser cachability issues (known bug)Set Cache-Control max-age or Minimum TTL very far futureDepending on request frequency, CloudFront might remove the object before its expirationDefault expiration 24hrs
Wednesday, 7 August 13
ExpirationBrowser cachability issues (known bug)Set Cache-Control max-age or Minimum TTL very far futureDepending on request frequency, CloudFront might remove the object before its expirationDefault expiration 24hrsObjects are cached for max {Cache-Control max-age directive, Cache Behavior Minimum TTL}
Wednesday, 7 August 13
Domain Sharding
Wednesday, 7 August 13
Domain ShardingTo increase client side performance
Wednesday, 7 August 13
Domain ShardingTo increase client side performanceOn average 100+ resources on an ecommerce page
Wednesday, 7 August 13
Domain ShardingTo increase client side performanceOn average 100+ resources on an ecommerce pageBrowsers limit the number of simultaneous connections to one server
Wednesday, 7 August 13
Domain ShardingTo increase client side performanceOn average 100+ resources on an ecommerce pageBrowsers limit the number of simultaneous connections to one serverHence limit the parallel download from one server
Wednesday, 7 August 13
Domain Sharding
Wednesday, 7 August 13
Domain ShardingUse two or more CNAME aliases to serve the content from a CF distribution
Wednesday, 7 August 13
Domain ShardingUse two or more CNAME aliases to serve the content from a CF distributionBrowser treat them as different servers
Wednesday, 7 August 13
Domain ShardingUse two or more CNAME aliases to serve the content from a CF distributionBrowser treat them as different serversSharding across 2 CNAME aliases will double the parallel download (Best 2-3)
Wednesday, 7 August 13
Domain ShardingUse two or more CNAME aliases to serve the content from a CF distributionBrowser treat them as different serversSharding across 2 CNAME aliases will double the parallel download (Best 2-3)More than 4 CNAME will degrade browser performance (high CPU and memory uses)
Wednesday, 7 August 13
Domain Sharding
Wednesday, 7 August 13
Domain Sharding
Use CF CNAME alias feature
Wednesday, 7 August 13
Domain Sharding
Use CF CNAME alias featureUse Route 53 for CNAME Aliasing
Wednesday, 7 August 13
Domain Sharding
Use CF CNAME alias featureUse Route 53 for CNAME AliasingCustom Wild Card SSL Certificate
Wednesday, 7 August 13
Domain Sharding
Use CF CNAME alias featureUse Route 53 for CNAME AliasingCustom Wild Card SSL CertificateOn application side: enable CF sharding logic (template compilation etc)
Wednesday, 7 August 13
Domain Sharding
<span style="width:inherit;"> <a href="http://mysite.com/about"><img src="http://cf.mycloudfront.net/about.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/blogs"><img src="http://cf.mycloudfront.net/blogs.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/contact"><img src="http://cf.mycloudfront.net/cont.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/about"><img src="http://cf1.mycloudfront.net/about.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/blogs"><img src="http://cf2.mycloudfront.net/blogs.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/contact"><img src="http://cf1.mycloudfront.net/cont.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/about"><img src="{{ CDN_DOMAINS }}/about.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/blogs"><img src="{{ CDN_DOMAINS }}/blogs.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/contact"><img src="{{ CDN_DOMAINS }}/cont.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/about"><img src="http://mysite.com/about.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/blogs"><img src="http://mysite.com/blogs.jpg" alt=""/></a></span>
<span style="width:inherit;"> <a href="http://mysite.com/contact"><img src="http://mysite.com/cont.jpg" alt=""/></a></span>
CDN with domain shardingCDN without domain sharding
HTML Template
Without CDN
Compiled ORDOM Manipulation
Compiled ORDOM Manipulation
Wednesday, 7 August 13
Domain Sharding
Wednesday, 7 August 13
Domain Sharding
Wednesday, 7 August 13
Domain ShardingApply domain sharding only where it’s needed most
Wednesday, 7 August 13
Domain ShardingApply domain sharding only where it’s needed mostEvenly distribute the resources amongst the shards
Wednesday, 7 August 13
Domain ShardingApply domain sharding only where it’s needed mostEvenly distribute the resources amongst the shardsConsider performance overhead due to the DNS lookup and connection time
Wednesday, 7 August 13
Domain ShardingApply domain sharding only where it’s needed mostEvenly distribute the resources amongst the shardsConsider performance overhead due to the DNS lookup and connection timeSharding may not be good for Mobile Browsers (CPU, Battery Life)
Wednesday, 7 August 13
Bucket Organisation
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF Distribution
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF DistributionPlan your bucket organisation (object keys)
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF DistributionPlan your bucket organisation (object keys)Watch out for the upload paths
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF DistributionPlan your bucket organisation (object keys)Watch out for the upload paths
/video/uploads/, /audio/uploads/, /images/uploads/ BAD
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF DistributionPlan your bucket organisation (object keys)Watch out for the upload paths
/video/uploads/, /audio/uploads/, /images/uploads/ BAD/uploads/video/, /uploads/audio/, /uploads/image/ GOOD
Wednesday, 7 August 13
Bucket Organisation
Limited Cache Behavior per CF DistributionPlan your bucket organisation (object keys)Watch out for the upload paths
/video/uploads/, /audio/uploads/, /images/uploads/ BAD/uploads/video/, /uploads/audio/, /uploads/image/ GOOD
Use wild card patterns (/uploads/*)
Wednesday, 7 August 13
Logging
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3One log file per distribution
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3One log file per distributionCombine log files and analyze logs (EMR)
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3One log file per distributionCombine log files and analyze logs (EMR)W3C extended log file format
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3One log file per distributionCombine log files and analyze logs (EMR)W3C extended log file format Streaming log vs Download log
Wednesday, 7 August 13
LoggingEnable logging, store access log file to S3One log file per distributionCombine log files and analyze logs (EMR)W3C extended log file format Streaming log vs Download logContent Analytics: Popularity, Error etc
Wednesday, 7 August 13
Performance Testing
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPs
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → Backbone
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device3rd party service (Gomez), application monitor
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device3rd party service (Gomez), application monitor
Load Testing (Edge Location, Elastic IP Aware)
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device3rd party service (Gomez), application monitor
Load Testing (Edge Location, Elastic IP Aware)Clients request from different geolocations
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device3rd party service (Gomez), application monitor
Load Testing (Edge Location, Elastic IP Aware)Clients request from different geolocationsIndependent DNS request, different set of IPs
Wednesday, 7 August 13
Performance TestingTradition Load Testing not useful
Same DNS request, same set of IPsBackbone Testing (Ideal Word)
CDN Server → BackboneLast Mile (Real World, User Experience)
CDN Server → Backbone → Device3rd party service (Gomez), application monitor
Load Testing (Edge Location, Elastic IP Aware)Clients request from different geolocationsIndependent DNS request, different set of IPsDistribute load across set of IPs
Wednesday, 7 August 13
Thank YouQ & A
Wednesday, 7 August 13