Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to Get to Second Base with Your CDN

8,516 views

Published on

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.

Published in: Technology
  • Be the first to comment

How to Get to Second Base with Your CDN

  1. Getting to 2nd Base with your Content Delivery Network <ul><ul><li>Mike Brittain </li></ul></ul><ul><li>Engineering Architect </li></ul>
  2. Overview <ul><li>Measure your performance </li></ul><ul><li>Tweak your cache TTLs </li></ul><ul><li>Cache dynamic objects </li></ul><ul><li>Cache whole pages </li></ul><ul><li>Inspect origin hits </li></ul><ul><li>Use proper HTTP headers </li></ul><ul><li>Use multiple CDNs </li></ul><ul><li>Review CDN documentation </li></ul><ul><li>Engage your vendor </li></ul>
  3. Overview 20 Minutes
  4. Overview <ul><li>Cache dynamic objects </li></ul><ul><li>Inspect origin traffic </li></ul><ul><li>Cache HTML pages </li></ul>
  5. Typical Setup
  6. Typical Setup
  7. CDN Storage $$$
  8. Origin Pull CDN lingo for “reverse proxy”
  9. Response Headers <ul><li>Cache-control: max-age=3600 </li></ul><ul><li>Last-Modified: Mon, 16 Mar … </li></ul><ul><li>ETag: “82c7-378-8e2a” </li></ul>http://www.askapache.com/htaccess/apache-speed-etags.html
  10. Revalidation Requests <ul><li>GET /images/generated.css HTTP/1.1 </li></ul><ul><li>Host: origin.example.com </li></ul><ul><li>If-Modified-Since: Mon, 16 Mar … </li></ul><ul><li>If-None-Match: ” 82c7-378-8e2a ” </li></ul><ul><li>HTTP/1.1 200 OK </li></ul><ul><li>Content-Length: 35043 </li></ul><ul><li>... or ... </li></ul><ul><li>HTTP/1.1 304 Not Modified </li></ul>$$$ $
  11. 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
  12. Avoid Double Paying <ul><li>16 MB x 4,600 @ 0.35/GB ≈ $25 (CDN) </li></ul><ul><li>16 MB x 4,600 @ 0.50/GB ≈ $36 (origin) </li></ul><ul><li>$61 </li></ul>
  13. Avoid Double Paying <ul><li>16 MB x 4,600 @ 0.35/GB ≈ $25 (CDN) </li></ul><ul><li>16 MB x 23 @ 0.50/GB ≈ $0.18 (origin) </li></ul><ul><li>$25 </li></ul>- ish
  14. Cache HTML Pages
  15. Cache HTML Pages
  16. Cache HTML Pages Page built just for Mike
  17. Cache HTML Pages Serve generic version to the CDN Use client-side logic for personalization
  18. Cache HTML Pages Replace generic sections with tailored versions Cookies, JavaScript
  19. Cache HTML Pages Track short history of user interactions Fresh data only where needed Ajax, Cookies, JavaScript
  20. Cache HTML Pages Use tracking pixels for page views Real time data with Ajax, or fake it Ajax, Cookies, JavaScript
  21. Cache HTML Pages <ul><li>Search Results, </li></ul><ul><li>HTML frag., Public APIs, </li></ul><ul><li>XML, JSON, RSS </li></ul><ul><li>Do you GET it? </li></ul>
  22. Cache HTML Pages
  23. Cache HTML Pages TTLs of 3 mins to 1 hr Psst… under 60 seconds is okay, too.
  24. Cache HTML Pages 92%
  25. Thank You <ul><li>Slides, etc. </li></ul><ul><li>www.mikebrittain.com </li></ul><ul><li>Questions </li></ul><ul><li>[email_address] </li></ul>
  26. <ul><li>Wait… You’re still here? </li></ul>
  27. <ul><li>No, seriously… go away! </li></ul>
  28. HTTP Headers cURL, telnet, Charles, Fiddler, Firebug, etc.
  29. CDNs Fail <ul><li>Plan B </li></ul><ul><ul><li>Split traffic between (similar) CDNs </li></ul></ul><ul><ul><li>Origin servers </li></ul></ul><ul><ul><li>Cloud storage </li></ul></ul>
  30. CDNs Fail
  31. CDNs Fail <ul><li>Amazon CloudFront: $0.17/GB * </li></ul><ul><li>Rackspace Cloud Files: $0.22/GB </li></ul>JetS3t, Cyberduck, Transit, S3 Browser, S3Fox Plug-in, s3sync.rb, APIs, etc.
  32. Multiple CDNs <ul><li>Cost vs. Performance </li></ul><ul><ul><li>Time </li></ul></ul><ul><ul><li>Views </li></ul></ul>

×