1 / 27

Caching

Caching. Herng-Yow Chen. How caches improve performance and reduce cost How to measure their effectiveness Where to place caches to maximize impact Also explain how HTTP keeps cached copies fresh How caches interact with other caches and servers. Outline. Bandwidth Bottlenecks.

Download Presentation

Caching

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Caching Herng-Yow Chen

  2. How caches improve performance and reduce cost How to measure their effectiveness Where to place caches to maximize impact Also explain how HTTP keeps cached copies fresh How caches interact with other caches and servers Outline

  3. Bandwidth Bottlenecks

  4. Bandwidth-imposed transfer time delays, idealized (time in seconds)

  5. Flash Crowds

  6. Distance Delays

  7. Hits, Misses, and Revalidations (a) Cache hit Cache object Cache server client (b) Cache miss Server object Server object Cache server client (c) Cache revalidate hit Freshness check Cache object “Still fresh” Cache server client

  8. Revalidations (a) Revalidate hit (slow hit) Freshness check Cache object “Still fresh” Cache server client Server object same as cached copy (b) Revalidate miss Freshness check Server object Server object Cache server client Cached copy is out of date

  9. Revalidations (cont.) • Revalidate hit Revalidate request with If-Modified-Since GET /announce.html HTTP/1.0 If-Modified-Since: Sat, 29 Jun 2002, 14:30:00 GMT server Cache (browser cache or proxy cache) HTTP/1.0 304 Not Modified Date: Wed, 03 Jul 2002, 19:18:23 GMT Content-type: text/plain Content-length: 67 Expires: Fri, 05 Jul 2002, 05:00:00 GMT “Still fresh” response

  10. Revalidate hit 304 Not Modified response Revalidate miss 200 OK response, with the full content Object deleted 404 Not Found response Three cases in revalidation

  11. Hit Rate (Hit Ratio) The fraction of requests that are served from cache. Sometimes it is called document hit ratio. The hit rate ranges from 0 to 1 but is often described as a percentage, e.g., 0%, 40% (decent) , 100% Goal: even a modest-sized cache may contain enough popular documents to significantly improve performance and reduce traffic. Cache Performance measurement

  12. Represent the faction of all bytes transferred that were served from cache. This metric captures the degree of traffic savings. (e.g., 100%  no traffic went out across the Internet). Is preferred by people who are billed for each byte of traffic. Document hit rate doesn’t tell the whole story, because documents are not all the same size. Some large objects might be accessed less often but contribute more to overall traffic. Document Hit ratio vs. Byte Hit ratio Optimize for overall latency reduction. (document hit) Optimize for bandwidth saving (byte hit) Another metric: Byte Hit Rate

  13. Cache Topologies (a) Accessing private cache Internet client Private cache Web server (b) Accessing shared public cache Internet client Web server Public cache client

  14. Public Proxy Caches (a) Redundant accesses from private caches Internet client client Server client (b) Shared caches can reduce traffic Internet client client Server Cache client

  15. Proxy Cache Hierarchy

  16. Cache Meshes, Content Routing, and Peering X Y Origin server B’s access point A’s access point Wide area network X Sibling Organization A Organization B

  17. Cache Processing Steps

  18. Cache Processing Flowchart Request arrives Cached? no yes Fresh enough? Revalidated? no Revalidate with server no Fetch from server yes yes Store into cache Update freshness Of cached document Server to client

  19. Document Expiration HTTP/1.0 200 OK Date: Sat, 29 Jun 2002, 14:30:00 GMT Content-type: text/plain Content-length: 67 Expires: Fri, 05 Jul 2002, 05:00:00 GMT Independence Day sale at Joe’s Hardware Come shop with us today! HTTP/1.0 200 OK Date: Sat, 29 Jun 2002, 14:30:00 GMT Content-type: text/plain Content-length: 67 Cache-Control: max-age=484200 Independence Day sale at Joe’s Hardware Come shop with us today! (a) Expires header (b) Cache-Control:max-age header

  20. Expiration response headers

  21. Two conditional headers used in cache revalidation

  22. If-Modified-Since : Date Revalidation Conditional request GET /announce.html HTTP/1.0 If-Modified-Since: Sat,29 Jun 2002, 14:30:00 GMT HTTP/1.0 304 Not Modified Date: Wed, 03 Jul 2002, 19:18:23 GMT Expires: Fri, 05 Jul 2002, 14:30:00 GMT client Server Response (a)If-Modifies-Since successful revalidation Conditional request GET /announce.html HTTP/1.0 If-Modified-Since: Sat,29 Jun 2002, 14:30:00 GMT HTTP/1.0 200 OK Date: Fri, 05 Jul 2002, 14:30:00 GMT Content-type: text/plain Content-length: 124 Expires: Mon, 09 Sep 2002, 05:00:00 GMT All exterior house paint on sale through Labor Day. Just another reason for you to shop this summer at Joe’s Hardware! client Server Response (b)If-Modifies-Since failed revalidation

  23. If-None-Match:Entity Tag Revalidation Conditional request GET /announce.html HTTP/1.0 If-None-Match: “v2.6” ETag: “v2.6” ETag: “v2.6” HTTP/1.0 304 Not Modified Date: Wed, 03 Jul 2002, 19:18:23 GMT ETag: “v2.6” Expires: Fri, 05 Jul 2002, 05:00:00 GMT Server Cache Response

  24. Heuristic Expiration 20% of time between fresh and last modification (LM-factor=0.2) Cached copy is fresh for time period New expiration time When cache talked to server Last modified

  25. Cache-Control request directives

  26. HTTP-EQUIV tags cause problems, because most software ignores them

  27. Reference: Caching • http://www.w3.org/protocols/rfc2616/rfc2616.txt RFC 2616, “Hypertext Transfer Protocol,” by R. Fielding, J. Gettys, J.Mongul, H.Frystyk, L.Mastinter, P.Leach, and T.Berners-Lee. • Web Caching Duane Wessels, O’Reilly & Associates, Inc. • http://search.ietf.org/rfc/rfc3040.txt RFC 3040, “Internet Web Replication and Caching Taxonomy.” • Web Proxy Servers Ari Luotinen, Prentice Hall Computer Books. • http://search.ietf.org/rfc/rfc3143.txt RFC 3143, “Know HTTP Proxy/Caching Problems.” • http://www.squid-cache.org Squid Web Proxy Cache.

More Related