1 Caching in HTTP Representation and Management of Data on the Internet.

Slides:



Advertisements
Similar presentations
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
Advertisements

PACS – 06/21/14 1 Cache? What is caching? A way to increase the average rate of a process by preferentially using a copy of data in a faster, closer, probably.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
1 11 Web Caching Web Protocols and Practice. 2 Topics Web Protocols and Practice WEB CACHING  Cache Definition  Goals of Web Caching  Motivations for.
Internet Networking Spring 2006 Tutorial 12 Web Caching Protocols ICP, CARP.
HTTP – HyperText Transfer Protocol
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
HTTP HyperText Transfer Protocol Part 2.
How the web works: HTTP and CGI explained
What’s a Web Cache? Why do people use them? Web cache location Web cache purpose There are two main reasons that Web cache are used:  to reduce latency.
1 Spring Semester 2007, Dept. of Computer Science, Technion Internet Networking recitation #13 Web Caching Protocols ICP, CARP.
HTTP HyperText Transfer Protocol.
1 HTTP - Hypertext Transfer Protocol Arthur : Yigal Eliaspur Date :
Implementing ISA Server Caching. Caching Overview ISA Server supports caching as a way to improve the speed of retrieving information from the Internet.
The Internet 8th Edition Tutorial 1 Browser Basics.
HTTP HyperText Transfer Protocol Part 3.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Hypertext Transport Protocol CS Dick Steflik.
Nikolay Kostov Telerik Corporation
Proxy Servers 2 What Is a Proxy Server? Intermediary server between clients and the actual server Proxy processes request Proxy processes response Intranet.
 Proxy Servers are software that act as intermediaries between client and servers on the Internet.  They help users on private networks get information.
Web Proxy Server Anagh Pathak Jesus Cervantes Henry Tjhen Luis Luna.
Web Cache. Introduction what is web cache?  Introducing proxy servers at certain points in the network that serve in caching Web documents for faster.
1 Caching  Temporary storage of frequently accessed data (duplicating original data stored somewhere else)  Reduces access time/latency for clients 
1 3 Web Proxies Web Protocols and Practice. 2 Topics Web Protocols and Practice WEB PROXIES  Web Proxy Definition  Three of the Most Common Intermediaries.
HTTP Caching & Cache-Busting for Content Publishers Michael J. Radwin O’Reilly Open Source Convention July 28, 2004.
HyperText Transfer Protocol
Krerk Piromsopa. Web Caching Krerk Piromsopa. Department of Computer Engineering. Chulalongkorn University.
HTTP Protocol Specification
Web Caching: Replication on the World Wide Web Jonathan Bulava CSC8530 – Distributed Systems Dr. Paul Schragger.
Proxy Servers 2 What Is a Proxy Server? Intermediary server between clients and the actual server Proxy processes request Proxy processes response Intranet.
CSC 2720 Building Web Applications Getting and Setting HTTP Headers (With PHP Examples)
1 Lecture #7-8 HTTP – HyperText Transfer Protocol HAIT Summer 2005 Shimrit Tzur-David.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
5 Chapter Five Web Servers. 5 Chapter Objectives Learn about the Microsoft Personal Web Server Software Learn how to improve Web site performance Learn.
Traffic Control in Apache Jed Reynolds Blog.Bitratchet.com Where in your web site do you need traffic control?
HTTP and Web Server HTTP HTTP is the protocol used by Web applications to exchange information. HTTP is a simple stateless request-response protocol.
Web Server Design Week 4 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 2/03/10.
1 Caching in HTTP Representation and Management of Data on the Internet.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is.
© 2010 Computer Science Faculty, Kabul University HTTP CONTINUED… 4 TH LECTURE 2, May, 2010 Baseer Ahmad Baheer.
Web Cache Consistency. “Requirements of performance, availability, and disconnected operation require us to relax the goal of semantic transparency.”
On The Cooperation of Web Clients and Proxy Caches Yiu Fai Sit, Francis C.M. Lau, Cho-Li Wang Department of Computer Science The University of Hong Kong.
HTTP evolution - TCP/IP issues Lecture 4 CM David De Roure
Implementing ISA Server Caching
HTTP Here, we examine the hypertext transfer protocol (http) – originally introduced around 1990 but not standardized until 1997 (version 1.0) – protocol.
EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP) Ion Stoica Nov 20, 2001 (*)
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
1 COMP 431 Internet Services & Protocols HTTP Persistence & Web Caching Jasleen Kaur February 11, 2016.
COMP2322 Lab 2 HTTP Steven Lee Jan. 29, HTTP Hypertext Transfer Protocol Web’s application layer protocol Client/server model – Client (browser):
HTTP HyperText Transfer Protocol.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
Overview on Web Caching COSC 513 Class Presentation Instructor: Prof. M. Anvari Student name: Wei Wei ID:
winter 2001C.Watters1 Proxy Servers winter 2001C.Watters2 What is a Proxy Server? Intermediary server between clients and the actual server Proxy processes.
INTRODUCTION Dr Mohd Soperi Mohd Zahid Semester /16.
1 HTTP – HyperText Transfer Protocol Representation and Management of Data on the Internet.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
A tutorial on Web Caching
HyperText Transfer Protocol
WWW and HTTP King Fahd University of Petroleum & Minerals
HTTP request message: general format
Caching Temporary storage of frequently accessed data (duplicating original data stored somewhere else) Reduces access time/latency for clients Reduces.
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
Hypertext Transport Protocol
Web Caching? Web Caching:.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
Internet Applications
CSE 461 HTTP and the Web.
Presentation transcript:

1 Caching in HTTP Representation and Management of Data on the Internet

2 Reasons for Using Web Caches Reduce Latency –Since the cache is closer to the client, it takes less time for the client to get the object and display it Save bandwidth –Since each object is only gotten from the server once, it reduces the amount of bandwidth used by a client

3 More Reasons for Using Web Caches Reduces server load Gives some measure of failure redundancy

4 For example, how much traffic is saved if it is not required to send the Google icon with each search result?

5 Type of Web Caches Browser Caches –A portion of the hard disk is used to store objects that have already been displayed –If an objected is requested again (for example, by hitting the “ back ” button), the request is served from the browser cache Proxy Caches –These are shared caches – they serve many users

6 Proxy Caches client server proxy server GET /fruit/apple.gif

7 Benefit of Caching client 10Mbps LAN RR 1.5Mbps server 15 req/sec 100Kbits/req proxy server 24%-32% hit rate is possible, since many users share the cache and, therefore, there is a large number of shared hits Internet

8 Points to Consider When Designing a Web Site Caches can help the Web site to load faster Caches may “ hide ” the users of the Web site, making it difficult to see who is using the site Caches may serve content that is out of date, or stale

9 Terminology Representations are copies of objects that are stored in caches If a request is served from a cache, then it should be semantically transparent, that is, it should be the same as a request that is served from the origin server A representation is fresh if it is identical to the document that is stored in the origin server If it is not identical, then it is stale

10 The Risk in Caching Response might not be semantically transparent The cache should determine that the representation is fresh before sending it to the client If it is not fresh, the cache should forward the request to the origin server or to another cache

11 How Does Caching Improves Latency and Saves Bandwidth? In some cases, caching eliminates the need to send requests to the origin server by using an expiration mechanism In other cases, caching eliminates the need to return full responses from the origin server by using a validation mechanism

12 An Example of Using a Validation Mechanism client server cache Client: GET /fruit/apple.gif Server responds with Last-Modified-Date:... Server returns either 304 Not Modified or object Client sends GET /fruit/apple.gif … If-Modified-Since: … Client caches object and last-modified-date

13 The Following Objects are not Cached The object ’ s headers tell the cache not to keep the object The object has no validator (i.e., an Expires value, a Last-Modified value or an Etag) The object is authenticated or secured Dynamic pages ( “ ? ” or “ cgi-bin ” in the URL) and pages with cookies

14 Fresh Objects are Served from the Cache An object is fresh in the following cases: –The object has an expiry time or other age- controlling directive, and is still within the fresh period –The browser cache has already seen the object, and has been set to check for newer versions once a session –A proxy cache has received the object recently, and the object was modified relatively long ago (this is a heuristic – see later)

15 Validating an Object If the object is stale (i.e., not fresh), the cache will ask the origin server to validate the object In response, the origin server will either –tell the cache that the object has not changed, or –send a new copy of the object to the cache

16 The Expires HTTP Header A response may include an Expires header: Expires: Fri, 30 Oct :19:41 GMT If an expiry time is not specified, the cache can heuristically estimate the expiry time

17 A Possible Heuristic If the cache received the object 10 hours after it was last modified, then it can heuristically determine that the expiry time is 1 hour after it has received it In general, add 10% of the interval between the last-modification time (given by the Last-Modified header) and the time it was received

18 The Cache-Control Header (Introduced in HTTP 1.1) The following are possible values of the cache-control header in responses max-age=[seconds] –Specifies the maximum amount of time that an object will be considered fresh (similar to the Expires header) s-maxage=[seconds] –Similar to max-age, except that it only applies to proxy (shared) caches

19 More Possible Values of the Cache-Control Header public –Document is cacheable even if normal rules say that it shouldn ’ t be (e.g., authenticated document) private –The document is for a single user and can only be stored in private (non-shared) caches no-store –Document should never be cached and should not even be stored in a temporary location on disk (this value is intended to prevent inadvertent copies of sensitive information)

20 More Possible Values of the Cache-Control Header must-revalidate –Tell caches that they must obey any freshness information provided with the object (HTTP allows caches to take liberties with the freshness of objects) proxy-revalidate –Similar to must-revalidate, except that it only applies to proxy (shared) caches

21 No-Cache Some values of the Cache-Control header are meaningful in either responses or requests No-cache –In a response, it means not to cache the object –In a request, it means to bring a copy from the origin server (i.e., not to use a cache)

22 The Pragma Header The Pragma: no-cache request header is the same as no-cache in the Cash-Control request header Don ’ t use Pragma – its meaning is specified only for requests and it is used just for compatibility with HTTP 1.0 A Safer approach is to set both the Pragma and the Cache-Control response headers with the value no-cache

23 The Reload (Refresh) Button Hitting the reload button in the browser brings a copy from a shared cache, but not necessarily from the origin server –There is no 100% guarantee that this is a fresh copy Hitting Shift+Reload brings a 100%-guaranteed fresh copy

24 How Can a Client Force a Fresh Copy? A fresh copy is obtained from the origin server if the request includes the following header –Cache-Control: no-cache The proxy must revalidate its copy with the origin server if the following header is included in the request –Cache-Control: max-age=0

25 Who Adds Cache-Control Headers? The server –The configuration of the server determines which cache-control headers are added to responses –The author of the page can add headers by means of the.htaccess file (only in the Apache server) The Application that generates dynamic pages, e.g., servlets, ASP, PHP

26 Cache-Control in HTTP-EQUIV The author of the page can add, to the document itself, a cache-control header by means of the Meta HTTP-EQUIV tag – But usually only the browser interprets this tag Proxies along the way don ’ t read it, since they don ’ t read the document

27 Validators A validator is any mechanism that may help in determining whether a copy is fresh or stale –A strong validator is, for example, a counter that is incremented whenever the resource is changed –A weak validator is, for example, a counter that is incremented only when a significant change is made For example, if the only change in the site is the number of visitors …

28 Last-Modified Header The most common validator is the time when the document was last changed, the last-modified time –It is given by the Last-Modified header –This header should be included in every response –It is a weak validator if an object can change more than once within a one- second interval

29 ETag (Entity Tag) ETag is a validator generated by the server (i.e., unique identifier) –It is part of the HTTP 1.1 specification (not available in HTTP 1.0) The preferred behavior for an HTTP 1.1 origin server is to send both a strong entity tag and a Last-Modified value

30 Conditional Requests Some conditional headers are –If-Modified-Since –If-Unmodified-Since –If-None-Match These headers are used to validate an object (i.e., check with the origin server whether the object has changed)

31 HTTP/ Not Modified Date: Fri, 31 Dec :59:59 GMT [blank line] If-Modified-Since Header The If-Modified-Since : header is used with a GET request If the requested resource has been modified since the given date, the server returns the resource as it normally would (i.e., the header is ignored) Otherwise, the server returns a 304 Not Modified response, including the Date: header, but with no message body

32 If-Unmodified-Since Header The If-Unmodified-Since: header can be used with any method If the resource has not been modified since the given date, the server returns the same response as it normally would Otherwise, the server returns a 412 Precondition Failed response HTTP/ Precondition Failed [blank line]

33 If-None-Match Header If the ETag matches when an If-None- Match header is specified, then the object is really the same and is not returned

34 Links Read the caching tutorial at Try the cacheability engine at