- Forward


Caching
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Motivation
Back SMYC Forward
  • An Observation:
    • The same information gets transmitted over the network many times
  • Some Solutions:
    • Cache at the client
    • Cache at the server
    • Cache at intermediaries
Client-Side Caching
Back SMYC Forward
  • The Idea:
    • Keep a local copy
    • Check source to see if the content has changed
  • Questions:
    • How much to cache?
    • When to check? (e.g., every request, every day)
Server-Side Caching
Back SMYC Forward
  • The Idea:
    • Keep frequently requested items in memory
  • Questions:
    • How much to cache?
    • Cache replacement (e.g., least recently used, least frequently used)
    • When to update?
Caching at Intermediaries
Back SMYC Forward
  • Proxy Caching:
    • Reverse Proxies/Accelerators
      • Close to the server
    • Forward Proxies
      • Close to the client
      • Often implemented by "enterprises" (e.g., JMU)
      • Reduce traffic and/or decrease latency
  • Content Distribution Networks:
    • Replicate content at multiple locations
Caching at Intermediaries - Examples
Back SMYC Forward
  • Free:
    • Coral CDN
    • FreeCast
    • PeerCast
    • SquidCache
    • Xunlei
  • Commercial:
    • Akamai
    • CacheFlow
    • EdgeCast
    • Inktomi
    • SkyCache
Content Distribution Networks
Back SMYC Forward
  • The Concept:
    • Replicate content at multiple locations to improve performance and ensure that the content is "always" available
  • The Challenges:
    • Where to locate replicas?
    • How to replicate content?
    • How to find content (and choose between replicas)?
CDNs - Which Server?
Back SMYC Forward
  • Lowest Load?
    • Balances load on servers
  • Best Performer?
    • To improve performance
  • Geographically Close?
    • To improve performance
  • Any Live Server?
    • To improve fault tolerance
CNDs - What Layer/Protocol?
Back SMYC Forward
  • Routing (e.g., IP anycast):
    • Advantages: Transparent
    • Disadvantages: Complex, doesn't scale
  • Application Layer (e.g., HTTP redirect):
    • Advantages: Fine-grained control
    • Disadvantages: Additional load, application-specific
  • Naming/Directory Based (e.g., DNS selection):
    • Advantages: Reduces RTTs
    • Disadvantage: Domain-based not URL-based
Working with HTTP/HTML
Back SMYC Forward
  1. Client fetches HTML document from source
    • GET index.html from jmu.edu
  2. Appropriate replicating server is identified
    • va.mycdn.com
  3. URLs of replicated content are replaced in response
    • jmu.edu/images/quad.gif is replaced with va.mycdn.com/jmu.edu/images/quad.gif
  4. Client fetches va.mycdn.com/jmu.edu/images/quad.gif
    • The image may or may not have been cached on va.mycdn.com
    • If the image is not on va.mycdn.com, it acts as a proxy and requests it from jmu.edu
Using the Domain Name System
Back SMYC Forward
  • Canonical Name Records:
    • CNAME records indicate that a domain name is an alias
  • How They Can Be Used:
    • Delegate name resolution to a CDN that can find a nearby replicating server
Using the Domain Name System - An Example - Akamai
Back SMYC Forward
  1. Root server gives a nameserver (NS) record for Akamai
    • akamai.net
  2. The akamai.net nameserver returns an NS record for a nearby client
    • b.akamai.net
  3. The b.akamai.net nameserver returns an appropriate nearby server
    • a1105.b.akamai.net
Using the Domain Name System - An Example (cont.)
Back SMYC Forward

dig www.bestbuy.com
;; ANSWER SECTION:
www.bestbuy.com.  3600     IN  CNAME   www.bestbuy.com.edgesuite.net.
www.bestbuy.com.edgesuite.net. 21600 IN   CNAME   a1105.b.akamai.net.  
a1105.b.akamai.net.   20   IN   A   198.7.236.235  
a1105.b.akamai.net.   20   IN   A   198.7.236.240  
;; AUTHORITY SECTION:  
b.akamai.net.   1101  IN   NS   n1b.akamai.net.  
b.akamai.net.   1101  IN   NS   n0b.akamai.net.  
;; ADDITIONAL SECTION:  
n0b.akamai.net.   1267 IN  A    24.143.194.45  
n1b.akamai.net.   2196 IN  A    198.7.236.236  
  

There's Always More to Learn
Back -