Top Banner
Getting to 2nd Base with your Content Delivery Network Mike Brittain Engineering Architect
32

Getting to 2nd Base with your Content Delivery Network

Feb 22, 2016

Download

Documents

Hilde

Getting to 2nd Base with your Content Delivery Network. Mike Brittain Engineering Architect. Overview. Measure your performance Tweak your cache TTLs Cache dynamic objects Cache whole pages Inspect origin hits Use proper HTTP headers Use multiple CDNs Review CDN documentation - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Getting to 2nd Base with your Content Delivery Network

Getting to 2nd Base with your ContentDelivery NetworkMike BrittainEngineering Architect

Page 2: Getting to 2nd Base with your Content Delivery Network

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: Getting to 2nd Base with your Content Delivery Network

Overview

20 Minutes

Page 4: Getting to 2nd Base with your Content Delivery Network

Overview

1. Cache dynamic objects2. Inspect origin traffic3. Cache HTML pages

Page 5: Getting to 2nd Base with your Content Delivery Network

Typical Setup

Page 6: Getting to 2nd Base with your Content Delivery Network

Typical Setup

Page 7: Getting to 2nd Base with your Content Delivery Network

CDN Storage

$$$

Page 8: Getting to 2nd Base with your Content Delivery Network

Origin Pull

CDN lingo for “reverse proxy”

Page 9: Getting to 2nd Base with your Content Delivery Network

Response Headers

Cache-control: max-age=3600Last-Modified: Mon, 16 Mar …ETag: “82c7-378-8e2a”

http://www.askapache.com/htaccess/apache-speed-etags.html

Page 10: Getting to 2nd Base with your Content Delivery Network

Revalidation Requests

GET /images/generated.css HTTP/1.1Host: origin.example.comIf-Modified-Since: Mon, 16 Mar …If-None-Match: ”82c7-378-8e2a”

HTTP/1.1 200 OKContent-Length: 35043 ... or ...HTTP/1.1 304 Not Modified

$$$

$

Page 11: Getting to 2nd Base with your Content Delivery Network

Review Origin Logs

Requests URL Size28 /images/logo.gif 2 KB17 /images/nav_tabs.png 5 KB4,613 /images/annual_report.ppt 16 MB31 /images/flames.gif 13 KB

Page 12: Getting to 2nd Base with your Content Delivery Network

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: Getting to 2nd Base with your Content Delivery Network

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: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Page 15: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Page 16: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Page built just

for Mike

Page 17: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Serve generic version to

the CDN

Use client-side logic for

personalization

Page 18: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Replace generic

sections with tailored

versions

Cookies,

JavaScript

Page 19: Getting to 2nd Base with your Content Delivery Network

Cache HTML PagesTrack short history of

user interactions

Fresh data only

where needed

Ajax, Cookies,

JavaScript

Page 20: Getting to 2nd Base with your Content Delivery Network

Cache HTML PagesUse tracking pixels for

page views

Real time data with Ajax,

or fake it

Ajax, Cookies,

JavaScript

Page 21: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Search Results,HTML frag., Public APIs,

XML, JSON, RSS

Do you GET it?

Page 22: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

Page 23: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

TTLs of 3 mins to 1 hr

Psst… under 60 seconds is okay, too.

Page 24: Getting to 2nd Base with your Content Delivery Network

Cache HTML Pages

92%

Page 25: Getting to 2nd Base with your Content Delivery Network

Thank You

Slides, etc.

www.mikebrittain.com

Questions

[email protected]

Page 26: Getting to 2nd Base with your Content Delivery Network

Wait… You’re still here?

Page 27: Getting to 2nd Base with your Content Delivery Network

No, seriously… go away!

Page 28: Getting to 2nd Base with your Content Delivery Network

HTTP Headers

cURL, telnet, Charles, Fiddler, Firebug, etc.

Page 29: Getting to 2nd Base with your Content Delivery Network

CDNs Fail

Plan B Split traffic between (similar)

CDNs Origin servers Cloud storage

Page 30: Getting to 2nd Base with your Content Delivery Network

CDNs Fail

Page 31: Getting to 2nd Base with your Content Delivery Network

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: Getting to 2nd Base with your Content Delivery Network

Multiple CDNs

Cost vs. Performance

Time

Views