Share
Embed
Content Delivery Networks
The speed of light is the maximum speed at which all energy, matter, and information can travel
saracubillas
January 12, 2015
Transcript
34 slides
-
–Albert Einstein “The speed of light is the maximum speed
at which all energy, matter, and information can travel” -
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. -
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. -
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 -
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 -
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 -
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 -
Before CDNs • Sending content from the source to 4
users takes 4 x 3 = 12 “network hops” in the example -
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) -
DNS resolution of site gives different answers to clients –
Tell each client the site is the nearest replica (map client IP) -
Anatomy of a Delivery Network *The Akamai Network: A Platform
for High-Performance Internet Applications -
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 -
Why Is Caching Dynamic Content Difficult? Serving stale pages -
Lack of invalidation framework ! Losing visibility: - Analytic/stats - Logging tracking -
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 -
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) -
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 -
Control • Programmability - Configuration API - Invalidation API -
Instantaneous and real time -
Caching Control • Granular caching - Dynamic caching - and
uncaching! - Flexible cache keys - etc • Ex: Geo-based caching -
Control at the Edge • Moving app logic to the
edge • VCL • Varnish Configuration Language • Script-like configuration for functionality at the edge -
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 -
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 -
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