Understanding Hurricane Response for Improved Stakeholder/User Reaction
Using Amazon CloudFront for Improved Response Time
-
Upload
ehwinter -
Category
Technology
-
view
118 -
download
4
description
Transcript of Using Amazon CloudFront for Improved Response Time
![Page 1: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/1.jpg)
Eric Winter
webicus internet services
Using Amazon CloudFront for Improved Site Response Time
![Page 2: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/2.jpg)
MotivationIntroduction to Amazon CloudFront
Basic architecture How it works/how its used
Operations – interacting with CloudFrontToolsDemoProgram using CloudFront
Results
Overview
![Page 3: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/3.jpg)
The Jonas Brothers made me do it….
Content management web siteHigh number of (static) assets/pageGeographically diverse users (but domestic
only)Download time generally slow, with high
varianceConclusion: Give it a try
Motivation
![Page 4: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/4.jpg)
Why Improves site response timeEasy to useReduces response time variation Cheap as dirtReliableEspecially worthwhile if you have
heavy contenta weak servera geographically diverse audience
Why notYet another level of cachingSome implementation/maintenance costs
Overview
![Page 5: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/5.jpg)
MotivationIntroduction to Amazon CloudFront
Basic architecture How it works/how its used
Operations – interacting with CloudFrontToolsDemoProgram using CloudFront
Results
Overview
![Page 6: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/6.jpg)
“Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Services to give developers and businesses an easy way to distribute content to end users with low latency, high data transfer speeds, and no commitments.”
Introduction to Amazon CloudFront
![Page 7: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/7.jpg)
CloudFront is a CDN (content distribution network)
Tightly integrated with S3CloudFront is not S3
S3 is designed to easily store data e.g. offsite backupS3 is the backend/system of record for CloudFront
CloudFront is designed specifically to improve static content delivery e.g. serving your home page images, css files,
etc.Serving large files
Initial thoughts on CloudFront
![Page 8: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/8.jpg)
CloudFront moves your S3 content to the ‘edge’ geographically closer to your end user thereby reducing latencySFO, VA, NYC, Ireland, Hong Kong
Pull modelContent pulled to edge upon first requestContent expires in 24hrs (default)
Edge server not aware of origin server content changes.
Content is Closer to User
![Page 9: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/9.jpg)
Heavy static content served by CloudFront edge server
Missing or expired content pulled from S3
Content served to disparate users
![Page 10: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/10.jpg)
Original files go into an Amazon S3 bucketI recommend naming the bucket something
obvious like site.com and have it’s structure track your site’s directory structure.
Create a “distribution” to register that bucket with Amazon CloudFrontFor simplicity structure the bucket w/ the same
ACL Your static files are now available on
CloudFront via the distribution’s domain name.
Create a CloudFront Distribution
![Page 11: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/11.jpg)
MotivationIntroduction to Amazon CloudFront
Basic architecture How it works/how its used
Operations – interacting with CloudFrontToolsDemoProgram using CloudFront
Results
Overview
![Page 12: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/12.jpg)
Firefox (plugins)S3FoxFirebugPagespeedYslow
Asset referencesMigration tools
Tools for CloudFront
![Page 13: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/13.jpg)
Move content to S3Create a distributionReference via CloudFront URL
Demo
![Page 14: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/14.jpg)
Ideally simple API to interact with CDNSeamlessly switch between local content and
CDNEnvironment sensitive
Would like to develop with local assetsWould like to test with local and CDN
(CloudFront) assetsMay want multiple CNAMEs
static1.example.comstatic2.example.comEtc.
Using CloudFront in an App
![Page 15: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/15.jpg)
CdnHelper – Helper Class Private members
private $useLocal = FALSE; private $numHostsMin = 0; private $numHostsMax = 3; private $sslHost = 'static
%d.site.com'; private $imgDir = 'images'; private $jsDir = 'jscript'; private $resourceDir =
'resources'; private $cssDir = 'style'; private $assetDir = NULL; private $forceTimestamp =
TRUE;
public methods Constructor (singleton)
ENV and CDN_FORCE
Each returns an URL setUseLocal($bool); image($assets, $options = array()) ; js($assets, $inline = true) ; css($assets) ; resource($assets) ;
Usage:$cdn= new
CdnHelper;$cdn-
>css(“style.css”);
![Page 16: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/16.jpg)
To S3S3Fox – very useful for quickly moving content
to S3/CloudfrontAPI/rails gems/capistrano – more stable way of
migrating content.To CloudFront
CloudFront != S3 (sometimes)CloudFront expires in 24hrs by defaultCloudFront does not check S3 if asset is present on
CF.Create new files and deprecate old ones
Migrating New Content
![Page 17: Using Amazon CloudFront for Improved Response Time](https://reader035.fdocuments.net/reader035/viewer/2022070304/54c6ad0a4a79594e668b457c/html5/thumbnails/17.jpg)
Relatively high traffic site (8k unique visitors, 18k pageviews/week)
Dynamic PHP financial sector, mainly financial charts
Page weight: 440k, 48 requests (lots of small images)
Verio managed server
Before 6-8 seconds for typical page
After1.5-2.5 seconds (as measured by pingdom.com)
Example Site – 3.5 x faster