15-441 Computer Networking Lecture 25 – The Web.

Slides:



Advertisements
Similar presentations
Nick Feamster CS 3251: Computer Networking I Spring 2013
Advertisements

1 Server Selection & Content Distribution Networks (slides by Srini Seshan, CS CMU)
HyperText Transfer Protocol (HTTP)
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
Chapter 9 Application Layer, HTTP Professor Rick Han University of Colorado at Boulder
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
Distributed Systems Spring 2009
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Chapter 2: Application Layer
EEC-484/584 Computer Networks Discussion Session for HTTP and DNS Wenbing Zhao
HyperText Transfer Protocol (HTTP) Computer Networks Computer Networks Spring 2012 Spring 2012.
15-441: Computer Networking The “Web” Thomas Harris (slides from Srini Seshan’s Fall ’01 course)
15-744: Computer Networking L-20 Applications. L -20; © Srinivasan Seshan, Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.
15-744: Computer Networking
HTTP and Web Content Delivery COS 461: Computer Networks Spring 2011 Mike Freedman
Web Content Delivery Reading: Section and COS 461: Computer Networks Spring 2010 (MW 3:00-4:20 in CS105) Mike Freedman
Chapter 2 Application Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley, July.
Web, HTTP and Web Caching
15-744: Computer Networking L-21: Caching and CDNs.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
15-744: Computer Networking L-21 Applications. L -21; © Srinivasan Seshan, Next Lecture: Application Networking HTTP Adaptive applications.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Web Content Delivery Reading: Section and COS 461: Computer Networks Spring 2009 (MW 1:30-2:50 in CS105) Mike Freedman Teaching Assistants:
Network Protocols: Design and Analysis Polly Huang EE NTU
CS640: Introduction to Computer Networks Aditya Akella Lecture 18 - The Web, Caching and CDNs.
HTTP Reading: Section and COS 461: Computer Networks Spring
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.
2: Application Layer1 CS 4244: Internet Software Development Dr. Eli Tilevich.
Application Layer 2 Figures from Kurose and Ross
Rensselaer Polytechnic Institute Shivkumar Kalvanaraman, Biplab Sikdar 1 The Web: the http protocol http: hypertext transfer protocol Web’s application.
20-1 Last time □ NAT □ Application layer ♦ Intro ♦ Web / HTTP.
Week 11: Application Layer1 Web and HTTP First some jargon r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,…
Introduction 1 Lecture 6 Application Layer (HTTP) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
2: Application Layer1 Web and HTTP First some jargon Web page consists of base HTML-file which includes several referenced objects Object can be HTML file,
1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW p Waleed Ejaz
CS640: Introduction to Computer Networks Aditya Akella Lecture 4 - Application Protocols, Performance.
2: Application Layer1 Chapter 2 outline r 2.1 Principles of app layer protocols r 2.2 Web and HTTP r 2.3 FTP r 2.4 Electronic Mail r 2.5 DNS r 2.6 Socket.
Hui Zhang, Fall Computer Networking Web, HTTP, Caching.
15-744: Computer Networking L-21: Caching and CDNs Amit Manjhi.
1 HTTP EECS 325/425, Fall 2005 September Chapter 2: Application layer r 2.1 Principles of network applications m app architectures m app requirements.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 8 Omar Meqdadi Department of Computer Science and Software Engineering University of.
Application Layer 2-1 Chapter 2 Application Layer 2.2 Web and HTTP.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
CSE 524: Lecture 4 Application layer protocols. Administrative ● Reading assignment Chapter 2 ● Mid-term exam may be delayed to 11/2/2004 – Mostly on.
Dr. Philip Cannata 1 The Web and HTTP. Dr. Philip Cannata 2 Application Layer 2-2 Chapter 2 Application Layer Computer Networking: A Top Down Approach.
Application Layer 2-1 Lecture 4: Web and HTTP. Web and HTTP First, a review… web page consists of objects object can be HTML file, JPEG image, Java applet,
Important r There will be NO CLASS on Friday 1/30/2015! r Please mark you calendars 1.
2: Application Layer 1 Chapter 2: Application layer r 2.1 Principles of network applications  app architectures  app requirements r 2.2 Web and HTTP.
Overview of Servlets and JSP
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 2: Application.
1 COMP 431 Internet Services & Protocols HTTP Persistence & Web Caching Jasleen Kaur February 11, 2016.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 7 Omar Meqdadi Department of Computer Science and Software Engineering University of.
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Computer Networking The Web. 2 Web history 1945: Vannevar Bush, “As we may think”, Atlantic Monthly, July, describes the idea of a distributed.
HyperText Transfer Protocol (HTTP) Deepti Kulkarni CISC 856: TCP/IP and Upper Layer Protocols Fall 2008 Acknowledgements Professor Amer Richi Gupta.
Application Layer 2-1 Chapter 2 Application Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012.
Week 11: Application Layer 1 Web and HTTP r Web page consists of objects r Object can be HTML file, JPEG image, Java applet, audio file,… r Web page consists.
© Janice Regan, CMPT 128, Jan 2007 CMPT 371 Data Communications and Networking HTTP 0.
Lecture 5 Internet Core: Protocol layers. Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP 
2: Application Layer 1 Chapter 2 Application Layer These ppt slides are originally from the Kurose and Ross’s book. But some slides are deleted and added.
Block 5: An application layer protocol: HTTP
HTTP request message: general format
Internet transport protocols services
Web Caching? Web Caching:.
Web Caching, Content Delivery Networks, Consistent Hashing
Computer Communication & Networks
Lecture 6 – Web Optimizations
Hypertext Transfer Protocol (HTTP)
CSCI-351 Data communication and Networks
Presentation transcript:

15-441 Computer Networking Lecture 25 – The Web

Outline HTTP intro and details Persistent HTTP HTTP caching Content distribution networks Lecture 25: 4-20-2004

HTTP layered over bidirectional byte stream Interaction HTTP Basics HTTP layered over bidirectional byte stream Almost always TCP Interaction Client sends request to server, followed by response from server to client Requests/responses are encoded in text Stateless Server maintains no information about past client requests Lecture 25: 4-20-2004

How to Mark End of Message? Size of message  Content-Length Must know size of transfer in advance Delimiter  MIME-style Content-Type Server must “escape” delimiter in content Close connection Only server can do this Lecture 25: 4-20-2004

HTTP Request Request line Method URL (relative) HTTP version GET – return URI HEAD – return headers only of GET response POST – send data to the server (forms, etc.) URL (relative) E.g., /index.html HTTP version Lecture 25: 4-20-2004

HTTP Request (cont.) Request headers Blank-line Body Authorization – authentication info Acceptable document types/encodings From – user email If-Modified-Since Referrer – what caused this page to be requested User-Agent – client software Blank-line Body Lecture 25: 4-20-2004

HTTP Request Lecture 25: 4-20-2004

HTTP Request Example GET / HTTP/1.1 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Host: www.intel-iris.net Connection: Keep-Alive Lecture 25: 4-20-2004

HTTP Response Status-line HTTP version 3 digit response code 1XX – informational 2XX – success 200 OK 3XX – redirection 301 Moved Permanently 303 Moved Temporarily 304 Not Modified 4XX – client error 404 Not Found 5XX – server error 505 HTTP Version Not Supported Reason phrase Lecture 25: 4-20-2004

HTTP Response (cont.) Headers Blank-line Body Location – for redirection Server – server software WWW-Authenticate – request for authentication Allow – list of methods supported (get, head, etc) Content-Encoding – E.g x-gzip Content-Length Content-Type Expires Last-Modified Blank-line Body Lecture 25: 4-20-2004

HTTP Response Example HTTP/1.1 200 OK Date: Tue, 27 Mar 2001 03:49:38 GMT Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24 Last-Modified: Mon, 29 Jan 2001 17:54:18 GMT ETag: "7a11f-10ed-3a75ae4a" Accept-Ranges: bytes Content-Length: 4333 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html ….. Lecture 25: 4-20-2004

Outline HTTP intro and details Persistent HTTP HTTP caching Content distribution networks Lecture 25: 4-20-2004

Typical Workload (Web Pages) Multiple (typically small) objects per page File sizes Heavy-tailed Pareto distribution for tail Lognormal for body of distribution Embedded references Number of embedded objects = pareto – p(x) = akax-(a+1) Lecture 25: 4-20-2004

One request/response per TCP connection Disadvantages HTTP 0.9/1.0 One request/response per TCP connection Simple to implement Disadvantages Multiple connection setups  three-way handshake each time Several extra round trips added to transfer Multiple slow starts Lecture 25: 4-20-2004

Single Transfer Example Client Server 0 RTT SYN Client opens TCP connection SYN 1 RTT ACK DAT Client sends HTTP request for HTML Server reads from disk ACK DAT FIN 2 RTT ACK Client parses HTML Client opens TCP connection FIN ACK SYN SYN 3 RTT ACK Client sends HTTP request for image DAT Server reads from disk ACK 4 RTT DAT Image begins to arrive Lecture 25: 4-20-2004

More Problems Short transfers are hard on TCP Stuck in slow start Loss recovery is poor when windows are small Lots of extra connections Increases server state/processing Server also forced to keep TIME_WAIT connection state Why must server keep these? Tends to be an order of magnitude greater than # of active connections, why? Lecture 25: 4-20-2004

Persistent Connection Solution Multiplex multiple transfers onto one TCP connection How to identify requests/responses Delimiter  Server must examine response for delimiter string Content-length and delimiter  Must know size of transfer in advance Block-based transmission  send in multiple length delimited blocks Store-and-forward  wait for entire response and then use content-length Solution  use existing methods and close connection otherwise Lecture 25: 4-20-2004

Persistent Connection Example Client Server 0 RTT DAT Client sends HTTP request for HTML Server reads from disk ACK DAT 1 RTT ACK Client parses HTML Client sends HTTP request for image DAT Server reads from disk ACK DAT 2 RTT Image begins to arrive Lecture 25: 4-20-2004

Persistent HTTP Nonpersistent HTTP issues: Requires 2 RTTs per object OS must work and allocate host resources for each TCP connection But browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP Server leaves connection open after sending response Subsequent HTTP messages between same client/server are sent over connection Persistent without pipelining: Client issues new request only when previous response has been received One RTT for each referenced object Persistent with pipelining: Default in HTTP/1.1 Client sends requests as soon as it encounters a referenced object As little as one RTT for all the referenced objects Lecture 25: 4-20-2004

Outline HTTP intro and details Persistent HTTP HTTP caching Content distribution networks Lecture 25: 4-20-2004

HTTP Caching Clients often cache documents Challenge: update of documents If-Modified-Since requests to check HTTP 0.9/1.0 used just date HTTP 1.1 has file signature as well When/how often should the original be checked for changes? Check every time? Check each session? Day? Etc? Use Expires header If no Expires, often use Last-Modified as estimate Lecture 25: 4-20-2004

Example Cache Check Request GET / HTTP/1.1 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate If-Modified-Since: Mon, 29 Jan 2001 17:54:18 GMT If-None-Match: "7a11f-10ed-3a75ae4a" User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Host: www.intel-iris.net Connection: Keep-Alive Lecture 25: 4-20-2004

Example Cache Check Response HTTP/1.1 304 Not Modified Date: Tue, 27 Mar 2001 03:50:51 GMT Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24 Connection: Keep-Alive Keep-Alive: timeout=15, max=100 ETag: "7a11f-10ed-3a75ae4a" Lecture 25: 4-20-2004

Web Proxy Caches User configures browser: Web accesses via cache Browser sends all HTTP requests to cache Object in cache: cache returns object Else cache requests object from origin server, then returns object to client origin server Proxy server HTTP request HTTP request client HTTP response HTTP response HTTP request HTTP response client origin server Lecture 25: 4-20-2004

Caching Example (1) Assumptions Average object size = 100,000 bits Avg. request rate from institution’s browser to origin servers = 15/sec Delay from institutional router to any origin server and back to router = 2 sec Consequences Utilization on LAN = 15% Utilization on access link = 100% Total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + milliseconds origin servers public Internet 1.5 Mbps access link institutional network 10 Mbps LAN Lecture 25: 4-20-2004

Caching Example (2) Possible solution Increase bandwidth of access link to, say, 10 Mbps Often a costly upgrade Consequences Utilization on LAN = 15% Utilization on access link = 15% Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + msecs origin servers public Internet 10 Mbps access link institutional network 10 Mbps LAN Lecture 25: 4-20-2004

Caching Example (3) Install cache origin Consequence servers Suppose hit rate is .4 Consequence 40% requests will be satisfied almost immediately (say 10 msec) 60% requests satisfied by origin server Utilization of access link reduced to 60%, resulting in negligible delays Weighted average of delays = .6*2 sec + .4*10msecs < 1.3 secs origin servers public Internet 1.5 Mbps access link institutional network 10 Mbps LAN institutional cache Lecture 25: 4-20-2004

Problems Over 50% of all HTTP objects are uncacheable – why? Not easily solvable Dynamic data  stock prices, scores, web cams CGI scripts  results based on passed parameters Obvious fixes SSL  encrypted data is not cacheable Most web clients don’t handle mixed pages well many generic objects transferred with SSL Cookies  results may be based on passed data Hit metering  owner wants to measure # of hits for revenue, etc. What will be the end result? Lecture 25: 4-20-2004

Content Distribution Networks (CDNs) The content providers are the CDN customers. Content replication CDN company installs hundreds of CDN servers throughout Internet Close to users CDN replicates its customers’ content in CDN servers. When provider updates content, CDN updates servers origin server in North America CDN distribution node CDN server in S. America CDN server in Asia CDN server in Europe Lecture 25: 4-20-2004

Outline HTTP intro and details Persistent HTTP HTTP caching Content distribution networks Lecture 25: 4-20-2004

Content Distribution Networks & Server Selection Replicate content on many servers Challenges How to replicate content Where to replicate content How to find replicated content How to choose among know replicas How to direct clients towards replica Lecture 25: 4-20-2004

Server Selection Which server? Lowest load  to balance load on servers Best performance  to improve client performance Based on Geography? RTT? Throughput? Load? Any alive node  to provide fault tolerance How to direct clients to a particular server? As part of routing  anycast, cluster load balancing Not covered  As part of application  HTTP redirect As part of naming  DNS Lecture 25: 4-20-2004

Application Based HTTP supports simple way to indicate that Web page has moved (30X responses) Server receives Get request from client Decides which server is best suited for particular client and object Returns HTTP redirect to that server Can make informed application specific decision May introduce additional overhead  multiple connection setup, name lookups, etc. While good solution in general, but… HTTP Redirect has some design flaws – especially with current browsers Lecture 25: 4-20-2004

Naming Based Client does name lookup for service Name server chooses appropriate server address A-record returned is “best” one for the client What information can name server base decision on? Server load/location  must be collected Information in the name lookup request Name service client  typically the local name server for client Lecture 25: 4-20-2004

How Akamai Works Clients fetch html document from primary server E.g. fetch index.html from cnn.com URLs for replicated content are replaced in html E.g. <img src=“http://cnn.com/af/x.gif”> replaced with <img src=“http://a73.g.akamaitech.net/7/23/cnn.com/af/x.gif”> Client is forced to resolve aXYZ.g.akamaitech.net hostname Lecture 25: 4-20-2004

How Akamai Works How is content replicated? Akamai only replicates static content Modified name contains original file name Akamai server is asked for content First checks local cache If not in cache, requests file from primary server and caches file Lecture 25: 4-20-2004

How Akamai Works Root server gives NS record for akamai.net Akamai.net name server returns NS record for g.akamaitech.net Name server chosen to be in region of client’s name server TTL is large G.akamaitech.net nameserver chooses server in region Should try to chose server that has file in cache - How to choose? Uses aXYZ name and hash TTL is small  why? Lecture 25: 4-20-2004

Simple Hashing Given document XYZ, we need to choose a server to use Suppose we use modulo Number servers from 1…n Place document XYZ on server (XYZ mod n) What happens when a servers fails? n  n-1 Same if different people have different measures of n Why might this be bad? Lecture 25: 4-20-2004

Consistent Hash “view” = subset of all hash buckets that are visible Desired features Balanced – in any one view, load is equal across buckets Smoothness – little impact on hash bucket contents when buckets are added/removed Spread – small set of hash buckets that may hold an object regardless of views Load – across all views # of objects assigned to hash bucket is small Lecture 25: 4-20-2004

Consistent Hash – Example Construction Assign each of C hash buckets to random points on mod 2n circle, where, hash key size = n. Map object to random position on circle Hash of object = closest clockwise bucket 14 Bucket 12 4 8 Smoothness  addition of bucket does not cause movement between existing buckets Spread & Load  small set of buckets that lie near object Balance  no bucket is responsible for large number of objects Lecture 25: 4-20-2004

How Akamai Works cnn.com (content provider) DNS root server Akamai server Get foo.jpg 12 11 Get index.html 5 1 2 3 Akamai high-level DNS server 6 4 7 Akamai low-level DNS server 8 Nearby matching Akamai server 9 10 End-user Get /cnn.com/foo.jpg Lecture 25: 4-20-2004

Akamai – Subsequent Requests cnn.com (content provider) DNS root server Akamai server Get index.html 1 2 Akamai high-level DNS server 7 Akamai low-level DNS server 8 Nearby matching Akamai server 9 10 End-user Get /cnn.com/foo.jpg Lecture 25: 4-20-2004

Impact on DNS Usage DNS is used for server selection more and more What are reasonable DNS TTLs for this type of use Typically want to adapt to load changes Low TTL for A-records  what about NS records? How does this affect caching? What do the first and subsequent lookup do? Lecture 25: 4-20-2004

HTTP (Summary) Simple text-based file exchange protocol Workloads Support for status/error responses, authentication, client-side state maintenance, cache maintenance Workloads Typical documents structure, popularity Server workload Interactions with TCP Connection setup, reliability, state maintenance Persistent connections How to improve performance Caching Replication Lecture 25: 4-20-2004

The rest of the slides are FYI EXTRA SLIDES The rest of the slides are FYI

Cookies: Keeping “state” Many major Web sites use cookies Four components: 1) Cookie header line in the HTTP response message 2) Cookie header line in HTTP request message 3) Cookie file kept on user’s host and managed by user’s browser 4) Back-end database at Web site Example: Susan access Internet always from same PC She visits a specific e-commerce site for first time When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID Lecture 25: 4-20-2004

Cookies: Keeping “State” (Cont.) client Amazon server usual http request msg usual http response + Set-cookie: 1678 cookie: 1678 usual http response msg cookie- specific action Cookie file ebay: 8734 server creates ID 1678 for user entry in backend database Cookie file amazon: 1678 ebay: 8734 access access one week later: Cookie file amazon: 1678 ebay: 8734 Lecture 25: 4-20-2004

Netscape Solution Mosaic (original popular Web browser) fetched one object at a time! Netscape uses multiple concurrent connections to improve response time Different parts of Web page arrive independently Can grab more of the network bandwidth than other users Doesn’t necessarily improve response time TCP loss recovery ends up being timeout dominated because windows are small Lecture 25: 4-20-2004

Persistent Connection Performance Benefits greatest for small objects Up to 2x improvement in response time Server resource utilization reduced due to fewer connection establishments and fewer active connections TCP behavior improved Longer connections help adaptation to available bandwidth Larger congestion window improves loss recovery Lecture 25: 4-20-2004

Proxy Implementation Problems Aborted transfers Many proxies transfer entire document even though client has stopped  eliminates saving of bandwidth Making objects cacheable Proxy’s apply heuristics  cookies don’t apply to some objects, guesswork on expiration May not match client behavior/desires Client misconfiguration Many clients have either absurdly small caches or no cache How much would hit rate drop if clients did the same things as proxies Lecture 25: 4-20-2004

Proxy Caching Goal: Satisfy client request without involving origin server Reduce client response time Reduce network bandwidth usage Wide area vs. local area use These two objectives are often in conflict May do exhaustive local search to avoid using wide area bandwidth Prefetching uses extra bandwidth to reduce client response time Lecture 25: 4-20-2004

Remaining Problems Serialized transmission Stall in transfer of one object prevents delivery of others Much of the useful information in first few bytes Can “packetize” transfer over TCP Could use range requests Application specific solution to transport protocol problems Solve the problem at the transport layer Could fix TCP so it works well with multiple simultaneous connections More difficult to deploy Lecture 25: 4-20-2004

Typical Workload (Server) Popularity Zipf distribution (P = kr-1)  surprisingly common Obvious optimization  caching Request sizes In one measurement paper  median 1946 bytes, mean 13767 bytes Why such a difference? Heavy-tailed distribution Pareto – p(x) = akax-(a+1) Temporal locality Modeled as distance into push-down stack Lognormal distribution of stack distances Request interarrival Bursty request patterns Lecture 25: 4-20-2004

Caching Proxies – Sources for Misses Capacity How large a cache is necessary or equivalent to infinite On disk vs. in memory  typically on disk Compulsory First time access to document Non-cacheable documents CGI-scripts Personalized documents (cookies, etc) Encrypted data (SSL) Consistency Document has been updated/expired before reuse Conflict No such misses Lecture 25: 4-20-2004

Naming Based Round-robin [Semi-]static metrics Randomly choose replica Avoid hot-spots [Semi-]static metrics Geography Route metrics How well would these work? Predicted application performance How to predict? Only have limited info at name resolution Lecture 25: 4-20-2004