Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Content Delivery Networks

Content Delivery Networks

The speed of light is the maximum speed at which all energy, matter, and information can travel

saracubillas

January 12, 2015
Tweet

More Decks by saracubillas

Other Decks in Technology

Transcript

  1. –Albert Einstein “The speed of light is the maximum speed

    at which all energy, matter, and information can travel”
  2. A CDN (content delivery network) is a network of servers

    located in different parts of a country (or the globe) that stores files to be used by your website visitors.
  3. Speed of light and propagation Latency source: “High Performance Browser

    Networking”, Ilya Grigorik The actual RTT between New York and Sydney, works out to be in the 200-300 milliseconds range.
  4. Waiting for the response • 100–200 milliseconds —> perception of

    “lag” ! • 300 millisecond —> “sluggish” ! • 1 second —> mental context switch, anything from a daydream to thinking about the next urgent task
  5. Waiting for the response • 40% of consumers will wait

    no more than 3 seconds* ! • CDNs improved website performance by caching static site content ! • The beauty of the virtual network approach: - it works over the existing Internet as is - requires no client software - can easily be adapted to future requirements as the Internet evolves ! * A 2009 Forrester Consulting survey
  6. Context • As the web took off in the 90s,

    traffic volumes grew and grew. This: ! 1. Concentrated load on popular servers ! 2. Led to congested networks and need to provision more bandwidth ! 3. Gave a poor user experience ! • Idea: – Place popular content near clients – Helps with all three issues above
  7. Why are CDNs becoming so popular? • Google has started

    using page speed as a ranking factor ! • Faster experience for users means happier users who buy more things and click more ads ! • The explosion of tablet and mobile users who depend on speed more so than desktop users who have stabler internet connections ! Some of the more known and reputable CDN companies: • Cloudflare (has free option) • Fastly • Amazon CloudFront • MaxCDN • Akamai • Cachefly
  8. Before CDNs • Sending content from the source to 4

    users takes 4 x 3 = 12 “network hops” in the example
  9. After CDNs • Sending content via replicas takes only 4

    + 2 = 6 “network hops” ! • Benefits assuming popular content: – Reduces server load, network load – Improves user experience (PLT)
  10. DNS resolution of site gives different answers to clients –

    Tell each client the site is the nearest replica (map client IP)
  11. Anatomy of a Delivery Network *The Akamai Network: A Platform

    for High-Performance Internet Applications
  12. What is Dynamic content? Stuff that’s not static! ! With

    web traffic, generally the base HTML -Big deal because it’s blocking -And sometimes a large object —>longer download ! Could be other things too -Ajax calls -API calls
  13. Why Is Caching Dynamic Content Difficult? Serving stale pages -

    Lack of invalidation framework ! Losing visibility: - Analytic/stats - Logging tracking
  14. CDNs and Dynamic content Generally, handling dynamic content has been

    a matter of transport ! • Optimize from-origin delivery ! • “DSA” (dynamic site acceleration) ! • Middle-mile optimizations ! • Dynamic content delivery/acceleration ! • TCP tweaks
  15. Dynamic content We sometimes do micro caching of HTML -

    Short TTL for HTML content via Cache-control - not really reliable ex: news stories ! ESI (Edge Side Includes) - Partial caching - hard and onerous ! Fastly solution(not everything is dynamic)
  16. Service-based Thinking • The CDN is an extension of the

    app • No longer a black box • Real time integration with the app • Infrastructure as a code - Your content => you need control
  17. Caching Control • Granular caching - Dynamic caching - and

    uncaching! - Flexible cache keys - etc • Ex: Geo-based caching
  18. Control at the Edge • Moving app logic to the

    edge • VCL • Varnish Configuration Language • Script-like configuration for functionality at the edge
  19. Visibility • Real time analytics • Network stats • HTTP

    stats (status codes, etc) • Caching stats (hits, misses,etc) • Stats API • Logging • Real time logs • Streaming to various log destination
  20. Summary • The speed of light is fast • The

    perception of the users is important, google speed ranking too • Distribute the content around the globe => reduce the propagation time • Dynamic content can be handled by CDNs too
  21. References • Ilya Grigorik .“High Performance Browser Networking”, O’Really. !

    • Rajkumar Buyya · Mukaddim Pathan · Athena Vakali (Eds.)Content Delivery Networks. Springer. • Hooman Beheshti talk: Caching the uncachable, at Velocityconf Europe 2014 • Erik Nygren, Ramesh K. Sitaraman, and Jennifer Sun. "The Akamai Network: A Platform for High-Performance Internet Applications, ACM SIGOPS Operating Systems Review, vol. 44, no. 3, July 2010.”. • Computer Networks Course from the University of Washington by David Wetherall, Arvind Krishnamurthy, John Zahorjan. - https://class.coursera.org/comnetworks-002 • A Beginner's Guide to HTTP Cache Headers- http://www.mobify.com/blog/beginners-guide-to-http-cache-headers/ • Content Delivery Networks - http://www.feedthebot.com/pagespeed/content-delivery-networks.html • Intro to caching and CDNs -https://docs.fastly.com/guides/how-fastly-services-work/intro-to-caching-and-cdns • Leveraging Your CDN to Cache Dynamic Content - http://www.fastly.com/blog/caching-dynamic-content/ • Gang Peng Department of Computer Science,State University of New York at Stony Brook, Stony Brook, NY 11794-4400. CDN: Content Distribution Network