HTTP and Web Content Delivery COS 461: Computer Networks Spring 2011 Mike Freedman

Slides:



Advertisements
Similar presentations
1 Server Selection & Content Distribution Networks (slides by Srini Seshan, CS CMU)
Advertisements

HyperText Transfer Protocol (HTTP)
Application Layer-11 CSE401N: Computer Networks Lecture-4 Application Layer Overview HTTP.
Chapter 9 Application Layer, HTTP Professor Rick Han University of Colorado at Boulder
Chapter 2: Application Layer
HyperText Transfer Protocol (HTTP) Computer Networks Computer Networks Spring 2012 Spring 2012.
How the web works: HTTP and CGI explained
CDNs & Replication Prof. Vern Paxson EE122 Fall 2007 TAs: Lisa Fowler, Daniel Killebrew, Jorge Ortiz.
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
5/12/05CS118/Spring051 A Day in the Life of an HTTP Query 1.HTTP Brower application Socket interface 3.TCP 4.IP 5.Ethernet 2.DNS query 6.IP router 7.Running.
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:
Caching and Content Distribution Networks. Web Caching r As an example, we use the web to illustrate caching and other related issues browser Web Proxy.
Content Distribution Networks (CDNs) Mike Freedman COS 461: Computer Networks Lectures: MW 10-10:50am in Architecture N101
Content Distribution Networks CPE 401 / 601 Computer Network Systems Modified from Ravi Sundaram, Janardhan R. Iyengar, and others.
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.
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.
2: Application Layer1 Internet apps: their protocols and transport protocols Application remote terminal access Web file transfer streaming multimedia.
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
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.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Sockets process sends/receives messages to/from its socket
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
Hui Zhang, Fall Computer Networking Web, HTTP, Caching.
Making the Best of the Best-Effort Service (2) Advanced Multimedia University of Palestine University of Palestine Eng. Wisam Zaqoot Eng. Wisam Zaqoot.
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.
1 CS 4396 Computer Networks Lab TCP/IP Networking An Example.
HyperText Transfer Protocol (HTTP) RICHI GUPTA CISC 856: TCP/IP and Upper Layer Protocols Fall 2007 Thanks to Dr. Amer, UDEL for some of the slides used.
CSE 6590 Department of Computer Science & Engineering York University 111/9/ :26 AM.
CIS679: Lecture 13 r Review of Last Lecture r More on HTTP.
CSx760 Computer Networks1 HTTP. CSx760 Computer Networks2 The Web: Some Jargon r Web page: m consists of “objects” m addressed by a URL r Most Web pages.
CSE 524: Lecture 4 Application layer protocols. Administrative ● Reading assignment Chapter 2 ● Mid-term exam may be delayed to 11/2/2004 – Mostly on.
1 OSI and TCP/IP Models. 2 TCP/IP Encapsulation (Packet) (Frame)
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,
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.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP) Ion Stoica Nov 20, 2001 (*)
Content Distribution Network, Proxy CDN: Distributed Environment
Computer Networking Lecture 25 – The Web.
LURP Details. LURP Lab Details  1.Given a GET … call a proxy CGI script in the same way you would for a normal CGI request  2.This UDP perl.
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.
Content Distribution Networks (CDNs)
1 Introductory material. This module illustrates the interactions of the protocols of the TCP/IP protocol suite with the help of an example. The example.
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.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Content Distribution Networks
Block 5: An application layer protocol: HTTP
Internet transport protocols services
Computer Communication & Networks
Lecture 6 – Web Optimizations
Content Distribution Networks
15-441: Computer Networking
EE 122: HyperText Transfer Protocol (HTTP)
Hypertext Transfer Protocol (HTTP)
CSCI-351 Data communication and Networks
Presentation transcript:

HTTP and Web Content Delivery COS 461: Computer Networks Spring 2011 Mike Freedman

Outline Layering HTTP HTTP connection management and caching Proxying and content distribution networks – Web proxies and hierarchical networks – Modern distributed CDNs (Akamai) Assignment #1 (available next week): – Write a basic Web proxy (It will work with your browser and real web pages!) 2

HTTP Basics HTTP layered over bidirectional byte stream Interaction – Client sends request to server, followed by response from server to client – Requests/responses are encoded in text Stateless – Server maintains no info about past client requests What about personalization? Data stored in back-end database; client sends “web cookie” used to lookup data 3

HTTP needs a stream of data Circuit Switching 4 Packet switching Today’s networks provide packet delivery, not streams!

What if the Data Doesn’t Fit? 5 Problem: Packet size Solution: Split the data across multiple packets Typical Web page is 10 kbytes On Ethernet, max IP packet is 1500 bytes GET /courses/archive/s GET index.html GET /courses/archive/spr09/cos461/ HTTP/1.1 Host: User-Agent: Mozilla/4.03 CRLF Request

Layering = Functional Abstraction Sub-divide the problem – Each layer relies on services from layer below – Each layer exports services to layer above Interface between layers defines interaction – Hides implementation details – Layers can change without disturbing other layers 6 Link hardware Host-to-host connectivity Application-to-application channels Application Sockets: streams – TCP datagrams - UDP Packets

Layer Encapsulation in HTTP Get index.html Connection ID Source/Destination Link Address User AUser B Link hardware Host-to-host connectivity App-to-app channels Application 7

IP Suite: End Hosts vs. Routers 8 HTTP TCP IP Ethernet interface HTTP TCP IP Ethernet interface IP Ethernet interface Ethernet interface SONET interface SONET interface host router HTTP message TCP segment IP packet

HTTP Request Example GET / HTTP/1.1 Host: sns.cs.princeton.edu Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: ) Gecko/ Firefox/ Connection: Keep-Alive 9

HTTP Request 10

HTTP Response Example HTTP/ OK Date: Wed, 02 Feb :01:21 GMT Server: Apache/2.2.3 (CentOS) X-Pingback: Last-Modified: Wed, 01 Feb :41:51 GMT ETag: "7a11f-10ed-3a75ae4a" Accept-Ranges: bytes Content-Length: 4333 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive 11

How to Mark End of Message? Close connection – Only server can do this Content-Length – Must know size of transfer in advance Implied length – E.g., 304 (NOT MODIFIED) never have body content Transfer-Encoding: chunked (HTTP/1.1) – After headers, each chunk is content length in hex, CRLF, then body. Final chunk is length 0. 12

Example: Chunked Encoding HTTP/ OK Transfer-Encoding: chunked 25 This is the data in the first chunk 1A and this is the second one 0 Especially useful for dynamically-generated content, as length is not a priori known 13

Single Transfer Example Client Server ACK DAT Server reads from disk Client sends HTTP request for HTML Client parses HTML 14

Single Transfer Example Client Server SYN ACK DAT FIN ACK 0 RTT 1 RTT 2 RTT Server reads from disk FIN Client opens TCP connection Client sends HTTP request for HTML Client parses HTML 15

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

Problems with simple model Multiple connection setups – Three-way handshake each time (TCP “synchronizing” stream) Short transfers are hard on stream protocol (TCP) – How much data should it send at once? – Congestion avoidance: Takes a while to “ramp up” to high sending rate (TCP “slow start”) – Loss recovery is poor when not “ramped up” Lots of extra connections – Increases server state/processing – Server forced to keep connection state 17

Outline Layering HTTP HTTP connection management and caching Proxying and content distribution networks – Web proxies and hierarchical networks – Modern distributed CDNs (Akamai) Assignment #1 (available next week): – Write a basic Web proxy (It will work with your browser and real web pages!) 18

Persistent Connection Example Client Server ACK DAT ACK 0 RTT 1 RTT 2 RTT Server reads from disk Client sends HTTP request for HTML Client parses HTML Client sends HTTP request for image Image begins to arrive DAT Server reads from disk DAT 19

Persistent HTTP Non-persistent HTTP issues: Requires 2 RTTs per object OS must allocate 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 object Persistent with pipelining: Default in HTTP/1.1 spec Client sends requests as soon as it encounters referenced object As little as one RTT for all the referenced objects Server must handle responses in same order as requests 20

“Persistent without pipelining” most common When does pipelining work best? – Small objects, equal time to serve each object – Small because pipelining simply removes additional 1 RTT delay to request new content Alternative design? – Multiple parallel connections (~2-4). Easier server parallelism – No “head-of-line blocking” problem like pipelining Dynamic content makes HOL blocking possibility worse In practice, many servers don’t support, and many browsers do not default to pipelining 21

HTTP Caching Clients often cache documents – When should origin be checked for changes? – Every time? Every session? Date? HTTP includes caching information in headers – HTTP 0.9/1.0 used: “Expires: ”; “Pragma: no-cache” – HTTP/1.1 has “Cache-Control” “No-Cache”, “Private”, “Max-age: ” “E-tag: ” If not expired, use cached copy If expired, use condition GET request to origin – “If-Modified-Since: ”, “If-None-Match: ” – 304 (“Not Modified”) or 200 (“OK”) response 22

HTTP Conditional Request GET / HTTP/1.1 Host: sns.cs.princeton.edu User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: ) Connection: Keep-Alive If-Modified-Since: Tue, 1 Feb :54:18 GMT If-None-Match: "7a11f-10ed-3a75ae4a" 23 HTTP/ Not Modified Date: Wed, 02 Feb :01:21 GMT Server: Apache/2.2.3 (CentOS) ETag: "7a11f-10ed-3a75ae4a" Accept-Ranges: bytes Keep-Alive: timeout=15, max=100 Connection: Keep-Alive

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, then returns to client client Proxy server client HTTP request HTTP response HTTP request HTTP response origin server origin server 24

When a single cache isn’t enough What if the working set is > proxy disk? – Cooperation! A static hierarchy – Check local – If miss, check siblings – If miss, fetch through parent Internet Cache Protocol (ICP) – ICPv2 in RFC 2186 (& 2187) – UDP-based, short timeout 25 public Internet Parent web cache

Web traffic has cacheable workload “Zipf” or “power-law” distribution 26 Characteristics of WWW Client-based Traces Carlos R. Cunha, Azer Bestavros, Mark E. Crovella, BU-CS-95-01

Content Distribution Networks (CDNs) Content providers are CDN customers Content replication CDN company installs thousands of servers throughout Internet – In large datacenters – Or, close to users CDN replicates customers’ content When provider updates content, CDN updates servers origin server in North America CDN distribution node CDN server in S. America CDN server in Europe CDN server in Asia 27

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 28

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 – As part of application: HTTP redirect – As part of naming: DNS 29

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Nearby Akamai cluster GET index. html 30 om/foo.jpg HTTP Akamai cluster Akamai global DNS server Akamai regional DNS server

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Nearby Akamai cluster 31 DNS lookup cache.cnn.com Akamai cluster 3 4 ALIAS: g.akamai.net Akamai global DNS server Akamai regional DNS server

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Akamai global DNS server Akamai regional DNS server Nearby Akamai cluster 32 Akamai cluster ALIAS a73.g.akamai.net DNS lookup g.akamai.net

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Akamai global DNS server Akamai regional DNS server Nearby Akamai cluster 33 Akamai cluster DNS a73.g.akamai.net Address

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Akamai global DNS server Akamai regional DNS server Nearby Akamai cluster 34 Akamai cluster GET /foo.jpg Host: cache.cnn.com

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Akamai global DNS server Akamai regional DNS server Nearby Akamai cluster 35 Akamai cluster GET /foo.jpg Host: cache.cnn.com GET foo.jpg

HTTP How Akamai Works End-user cnn.com (content provider) DNS root server 12 Akamai global DNS server Akamai regional DNS server Nearby Akamai cluster 36 Akamai cluster

Summary HTTP: Simple text-based file exchange protocol – Support for status/error responses, authentication, client- side state maintenance, cache maintenance Interactions with TCP – Connection setup, reliability, state maintenance – Persistent connections How to improve performance – Persistent and pipelined connections – Caching – Replication: Web proxies, cooperative proxies, and CDNs 37