how to get to second base with your cdn
DESCRIPTION
Tips on how to improve how you use your CDN. Condensed from a lot of material, this talk was crammed into 20 minutes.More info available at http://mikebrittain.com.TRANSCRIPT
![Page 1: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/1.jpg)
Getting to 2nd Base with your ContentDelivery Network
Mike BrittainEngineering Architect
![Page 2: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/2.jpg)
Overview
1. Measure your performance2. Tweak your cache TTLs3. Cache dynamic objects4. Cache whole pages5. Inspect origin hits6. Use proper HTTP headers7. Use multiple CDNs8. Review CDN documentation9. Engage your vendor
![Page 3: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/3.jpg)
Overview
20 Minutes
![Page 4: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/4.jpg)
Overview
1. Cache dynamic objects2. Inspect origin traffic3. Cache HTML pages
![Page 5: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/5.jpg)
Typical Setup
![Page 6: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/6.jpg)
Typical Setup
![Page 7: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/7.jpg)
CDN Storage
$$$
![Page 8: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/8.jpg)
Origin Pull
CDN lingo for “reverse proxy”
![Page 9: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/9.jpg)
Response Headers
Cache-control: max-age=3600
Last-Modified: Mon, 16 Mar …
ETag: “82c7-378-8e2a”
http://www.askapache.com/htaccess/apache-speed-etags.html
![Page 10: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/10.jpg)
Revalidation Requests
GET /images/generated.css HTTP/1.1
Host: origin.example.com
If-Modified-Since: Mon, 16 Mar …
If-None-Match: ”82c7-378-8e2a”
HTTP/1.1 200 OK
Content-Length: 35043
... or ...
HTTP/1.1 304 Not Modified
$$$
$
![Page 11: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/11.jpg)
Review Origin Logs
Requests URL Size
28 /images/logo.gif 2 KB
17 /images/nav_tabs.png 5 KB
4,613 /images/annual_report.ppt 16 MB
31 /images/flames.gif 13 KB
![Page 12: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/12.jpg)
Avoid Double Paying
16 MB x 4,600 @ 0.35/GB ≈ $25 (CDN)
16 MB x 4,600 @ 0.50/GB ≈ $36 (origin)
$61
![Page 13: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/13.jpg)
Avoid Double Paying
16 MB x 4,600 @ 0.35/GB ≈ $25 (CDN)
16 MB x 23 @ 0.50/GB ≈ $0.18 (origin)
$25- ish
![Page 14: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/14.jpg)
Cache HTML Pages
![Page 15: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/15.jpg)
Cache HTML Pages
![Page 16: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/16.jpg)
Cache HTML Pages
Page built just
for Mike
![Page 17: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/17.jpg)
Cache HTML Pages
Serve generic version to
the CDN
Use client-side logic for
personalization
![Page 18: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/18.jpg)
Cache HTML Pages
Replace generic
sections with tailored
versions
Cookies,
JavaScript
![Page 19: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/19.jpg)
Cache HTML PagesTrack short history of
user interactions
Fresh data only
where needed
Ajax, Cookies,
JavaScript
![Page 20: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/20.jpg)
Cache HTML PagesUse tracking pixels for
page views
Real time data with Ajax,
or fake it
Ajax, Cookies,
JavaScript
![Page 21: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/21.jpg)
Cache HTML Pages
Search Results,
HTML frag., Public APIs,
XML, JSON, RSS
Do you GET it?
![Page 22: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/22.jpg)
Cache HTML Pages
![Page 23: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/23.jpg)
Cache HTML Pages
TTLs of 3 mins to 1 hr
Psst… under 60 seconds is okay, too.
![Page 24: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/24.jpg)
Cache HTML Pages
92%
![Page 26: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/26.jpg)
Wait… You’re still here?
![Page 27: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/27.jpg)
No, seriously… go away!
![Page 28: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/28.jpg)
HTTP Headers
cURL, telnet, Charles, Fiddler, Firebug, etc.
![Page 29: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/29.jpg)
CDNs Fail
Plan B Split traffic between (similar)
CDNs Origin servers Cloud storage
![Page 30: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/30.jpg)
CDNs Fail
![Page 31: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/31.jpg)
CDNs Fail
Amazon CloudFront: $0.17/GB*
Rackspace Cloud Files: $0.22/GB
JetS3t, Cyberduck, Transit, S3 Browser, S3Fox Plug-in, s3sync.rb, APIs, etc.
![Page 32: How to Get to Second Base with Your CDN](https://reader036.vdocuments.us/reader036/viewer/2022062513/554bb09db4c905b3618b590a/html5/thumbnails/32.jpg)
Multiple CDNs
Cost vs. Performance
Time
Views