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.

Slides:



Advertisements
Similar presentations
Optimizing Websites with YSlow Tom Lianza Co-Founder Wishlisting.com Tom Lianza Co-Founder Wishlisting.com.
Advertisements

The Internet.
CS193H: High Performance Web Sites Lecture 17: Rule 14 – Make Ajax Cacheable Steve Souders Google
Enabling Secure Internet Access with ISA Server
The OWASP Foundation Web Application Security Host Apps Firewall Host Apps Database Host Web serverApp serverDB server Securing the.
CS 22: Enhanced Web Site Design - Week 8Slide 1 of 15 Enhanced Web Site Design Stanford University Continuing Studies CS 22 Mark Branom
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.
CHAPTER 15 WEBPAGE OPTIMIZATION. LEARNING OBJECTIVES How to test your web-page performance How browser and server interactions impact performance What.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Cache Definition Cache is pronounced cash. It is a temporary memory to store duplicate data that is originally stored elsewhere. Cache is used when the.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
1 Caching in HTTP Representation and Management of Data on the Internet.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
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.
Implementing ISA Server Caching. Caching Overview ISA Server supports caching as a way to improve the speed of retrieving information from the Internet.
HTTP HyperText Transfer Protocol Part 3.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
 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.
Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You.
 A cookie is a piece of text that a Web server can store on a user's hard disk.  Cookie data is simply name-value pairs stored on your hard disk by.
1 Caching  Temporary storage of frequently accessed data (duplicating original data stored somewhere else)  Reduces access time/latency for clients 
INTRODUCTION TO WEB DATABASE PROGRAMMING
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
 Internet vs WWW  Pages vs Sites  How the Internet Works  Getting a Web Presence.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Krerk Piromsopa. Web Caching Krerk Piromsopa. Department of Computer Engineering. Chulalongkorn University.
Web Caching: Replication on the World Wide Web Jonathan Bulava CSC8530 – Distributed Systems Dr. Paul Schragger.
Maryam Elahi University of Calgary – CPSC 441.  HTTP stands for Hypertext Transfer Protocol.  Used to deliver virtually all files and other data (collectively.
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?
Distributed File Systems Overview  A file system is an abstract data type – an abstraction of a storage device.  A distributed file system is available.
1 Caching in HTTP Representation and Management of Data on the Internet.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
© 2010 Computer Science Faculty, Kabul University HTTP CONTINUED… 4 TH LECTURE 2, May, 2010 Baseer Ahmad Baheer.
Empirical Quantification of Opportunities for Content Adaptation in Web Servers Michael Gopshtein and Dror Feitelson School of Engineering and Computer.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Web Server.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
The Internet. Important Terms Network Network Internet Internet WWW (World Wide Web) WWW (World Wide Web) Web page Web page Web site Web site Browser.
Overview on Web Caching COSC 513 Class Presentation Instructor: Prof. M. Anvari Student name: Wei Wei ID:
Web Cache. What is Cache? Cache is the storing of data temporarily to improve performance. Cache exist in a variety of areas such as your CPU, Hard Disk.
THE FUTURE IS HERE: APPLICATION- AWARE CACHING BY ASHOK ANAND.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Web Server Administration Chapter 6 Configuring a Web Server.
A tutorial on Web Caching
Web fundamentals: Clients, Servers, and Communication
Tonga Institute of Higher Education IT 141: Information Systems
How HTTP Works Made by Manish Kushwaha.
Web Concepts Lesson 2 ITBS2203 E-Commerce for IT.
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.
HTTP Protocol Specification
Hypertext Transport Protocol
Networks Problem Set 1 Due Oct 3 Bonus Date Oct 2
Web Caching? Web Caching:.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
Internet Applications
Tonga Institute of Higher Education IT 141: Information Systems
Configuring Internet-related services
CSE 461 HTTP and the Web.
HTML5 and Local Storage.
Tonga Institute of Higher Education IT 141: Information Systems
EE 122: HyperText Transfer Protocol (HTTP)
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
CSCI-351 Data communication and Networks
Presentation transcript:

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 more expensive location instead of the data’s original, more distant, slower, less expensive location. A way to determine whether the cached copy is valid is important.

PACS – 06/21/14 2 Cache Examples “The Zoo Photographer” example CPU Caching Disk Caching DNS Caching Web Caching

PACS – 06/21/14 3 CPU Cache

PACS – 06/21/14 4 CPU Cache Level AccessTypical Technology Managed TimeSizeBy Registers1-3 ns?1 KB Custom CMOS Compiler Level 1 Cache (on-chip) 2-8 ns8 KB-128 KBSRAMHardware Level 2 Cache (off-chip) 5-12 ns0.5 MB - 8 MBSRAMHardware Main Memory10-60 ns64 MB - 1 GBDRAMOperating System Hard Disk 3,000, GBMagnetic Operating System/User 10,000,000 ns

PACS – 06/21/14 5 CPU Cache

PACS – 06/21/14 6 CPU Cache

PACS – 06/21/14 7 Disk Caching Traditional Disk Cache is actually a disk buffer. It marries the faster bus timing with the slower rotating disk timing. Seagate Laptop and Ultra Mobile SSHDs integrate NAND flash with traditional hard drive storage to create a hybrid drive with the speed of solid state and the capacity of a hard drive. Boots Windows 7 up to 35% faster. Programs launch faster. Installs and works like a typical hard drive – no special device drivers needed Utilizes solid-state NAND flash and hard drive capacity for unmatched data integrity and reliability

PACS – 06/21/14 8 Disk Cache

PACS – 06/21/14 9 DNS Caching First request for a domain name: Each DNS server saves the results of each request along with an expiration time (TTL).

PACS – 06/21/14 10 DNS Cache Second request for the same domain name: If the cached value is valid, IP can be returned without further lookups. Clients also normally cache DNS results. In that case, no request to a DNS server is needed.

PACS – 06/21/14 11 Web Caching Why worry about speed? Users hate waiting! The browser save copies of images, stylesheets, javascript or the HTML. The next time the user needs that same resource for the same or a different web page the browser doesn’t have to download the file again. Fewer downloads means a faster, happier site. All browsers have cache areas available with sizes that can be controlled. There has to be a mechanism to allow for changed files on the server. Proxy servers will usually cache files to improve performance for their respective users.

PACS – 06/21/14 12 Web Caching Browsers use multiple methods of accessing a cached file depending on what the server supplied when the file was initially downloaded: Last-Modified – asks the server to decide based on the date of the browser’s copy. If-None-Match – asks the server to decide based on a unique characteristic of the file, like a hash. Expires – the browser will not ask the server if time is prior to the expiration time of the cached file. Max-age – like Expires but the server gives the browser a relative time rather than an absolute time when the file was first served. Different browsers may use any or all of the above approaches.

PACS – 06/21/14 13 Web Caching Other cache related headers: Cache-control: public means the cached version can be saved by proxies and other intermediate servers, where everyone can see it. Cache-control: private means the file is different for different users (such as their personal homepage). The user’s private browser can cache it, but not public proxies. Cache-control: no-cache means the file should not be cached. This is useful for things like search results where the URL appears the same but the content may change.

Web Caching PACS – 06/21/1414

Web Caching PACS – 06/21/1415

Web Caching PACS – 06/21/1416

Web Caching PACS – 06/21/1417

PACS – 06/21/14 18 Web Caching Apache Server Caching Guide: Apache Caching Header Guide: The general format for setting headers is File types to match Header / Expiration to set A general tip: the less a resource changes (images, pdfs, etc.) the longer you should cache it. If it never changes (every version has a different URL) then cache it for as long as you can (i.e. a year)!

PACS – 06/21/14 19 Web Caching If the response’s headers tell the cache not to keep it, it won’t. If the request is authenticated or secure (i.e., HTTPS), it won’t be cached. A cached representation is considered fresh (that is, able to be sent to a client without checking with the origin server) if: It has an expiry time or other age-controlling header set, and is still within the fresh period, or If the cache has seen the representation recently, and it was modified relatively long ago. Fresh representations are served directly from the cache, without checking with the origin server.

PACS – 06/21/14 20 Web Caching If a representation is stale, the origin server will be asked to validate it, or tell the cache whether the copy that it has is still good. Under certain circumstances — for example, when it’s disconnected from a network — a cache can serve stale responses without checking with the origin server. If no validator (an ETag or Last-Modified header) is present on a response, and it doesn't have any explicit freshness information, it will usually - but not always - be considered uncacheable.

Web Caching Using Expires Headers ExpiresActive On ExpiresDefault A0 # 1 YEAR - doesn't change often ExpiresDefault A # 1 WEEK - possible to be changed, unlikely ExpiresDefault A # 3 HOUR - core content, changes quickly ExpiresDefault A10800 “A” means “Access plus…”; “M” means “Modification plus…” PACS – 06/21/1421

Web Caching Using max-age headers: # 1 YEAR Header set Cache-Control "max-age= , public" # 1 WEEK Header set Cache-Control "max-age=604800, public" # 3 HOUR Header set Cache-Control "max-age=10800" # NEVER CACHE - notice the extra directives Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" PACS – 06/21/1422

PACS – 06/21/14 23 Web Caching Where do the cache related headers get set? Meta tags in HTML documents (Pragma: no-cache) are not effective. They’re only honored by few browsers and never by proxy servers. They should be set in HTTP headers. A typical complete set of headers might be: HTTP/ OK Date: Fri, 30 Oct :19:41 GMT Server: Apache/1.3.3 (Unix) Cache-Control: max-age=3600, must-revalidate Expires: Fri, 30 Oct :19:41 GMT Last-Modified: Mon, 29 Jun :28:12 GMT ETag: "3e fbbc" Content-Length: 1040 Content-Type: text/html

Web Caching In.htaccess: ExpiresActive On ExpiresDefault "access plus 1 year" Header append Cache-Control "must-revalidate, public" PACS – 06/21/1424

Web Caching In your PHP script: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul :00:00 GMT"); // Date in the past to force a new request OR if ($page_cache) { header("Expires: ".gmdate("D, d M Y H:i:s", $pltime + $page_cache)." GMT"); header("Cache-Control: must-revalidate, public"); header("Last-Modified: ".gmdate("D, d M Y H:i:s", filemtime(__FILE__))." GMT"); } // $page_cache PACS – 06/21/1425

PACS – 06/21/14 26 Web Caching Examine your site in Redbot.org to see what cache headers are being sent.Redbot.org Use Firebug (or Live HTTP Headers addon) with Firefox to see requests and responses to page accesses. Ctrl-F5 will tell the IE & FF browsers to ignore any cached files and request a fresh copy of the page.

PACS – 06/21/14 27 Web Caching Caching Tutorial for Web Authors and Webmasters: How To Optimize Your Site With HTTP Caching: -to-optimize-your-site-with-http- caching/ -to-optimize-your-site-with-http- caching/