HTTP
Web eb and d URLs Web page consists of objects Addressable by a URL Can be HTML file, JPEG image, Java applet, audio file,… Bound to a host name and a path name within host www.someschool.edu/someDept/pic.gif path name host name Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP Hypertext transfer protocol Web’s application layer protocol Send URL from client to server Return content from server to PC running Explorer client Client/server model HTTP 1.0: RFC 1945 Server HTTP 1.1: RFC 2068 running Apache Web server Mac running Navigator Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP over ervie view w (cont ntinued inued) Uses TCP: Client initiates bi-directional TCP connection (via socket) to server, port 80 Server accepts TCP connection from client HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) Messages encoded in text TCP connection closed Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP req equest uest me mess ssag age Two types of HTTP messages: request, response HTTP request message: ASCII (human-readable format) request line (GET, POST, GET /somedir/page.html HTTP/1.1 HEAD commands) Host: www.someschool.edu User-agent: Mozilla/4.0 header Connection: close lines Accept-language:fr Carriage return, (extra carriage return, line feed) line feed indicates end of message http://www.someschool.edu/somedir/page.html Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP res espon ponse se me mess ssag age status line (protocol status code HTTP/1.1 200 OK status phrase) Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last- Modified: Mon, 22 Jun 1998 …... header Content-Length: 6821 lines Content-Type: text/html Connection: close data, e.g., data data data data data ... requested HTML file Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP hea eader ders Contains a variety of headers for implementing Caching Session management (cookies) Authentication Tracking (referer) Localization (language) Content-encoding Covered in 494/594 and 495/595 classes (Internetworking Protocols and Web Security) Also contains headers for managing connection … Portland State University CS 430P/530 Internet, Web & Cloud Systems
Ser erial, ial, non-per persist sistent ent connect nnections ions HTTP/1.0 One request/response per connection simple to implement initiate TCP connection server parses request, responds, RTT and closes connection request RTT = round-trip time file total = 2RTT+transmit time RTT time to transmit file file receivedtime time Portland State University CS 430P/530 Internet, Web & Cloud Systems
Ser erial, ial, non-per persist sistent ent connect nnections ions Server Client 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 Then delivers HTML before closing the connection ACK Client parses HTML FIN Client opens TCP connection 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 Portland State University CS 430P/530 Internet, Web & Cloud Systems
Iss ssue ue Multiple embedded objects on page Connection setup latency adds extra round trips per transfer (e.g. TCP’s three-way handshake) Server and network overhead Connection handling, extra packets Short transfers hard on TCP (e.g. slow-start, loss recovery algorithm) Portland State University CS 430P/530 Internet, Web & Cloud Systems
Pa Parall rallel el non-per persis sistent ent conn nnection ections Netscape browser (1990s) Improve latency by using multiple concurrent connections Browsers often open up to 6-8 parallel TCP connections to fetch referenced objects Different parts of Web page arrive independently on separate connections (object demux via connections) Can grab more of the network bandwidth than other users Doesn’t improve response time all the time TCP connections contending with each other causing more packet losses and delay OS overhead for each TCP connection Portland State University CS 430P/530 Internet, Web & Cloud Systems
Per ersis sisten ent t HTTP TP connection nnections Default in HTTP/1.1 Server leaves connection open after sending response Client sends additional requests on the same connection as soon as it encounters a referenced object Subsequent HTTP messages between same client/server sent over open connection On same TCP connection: server, parses request, responds, parses new request,.. As little as one RTT for all the referenced objects Portland State University CS 430P/530 Internet, Web & Cloud Systems
Per ersis sisten ent t HTTP TP ben enef efits its Server overhead reduced Less connection setup, more data transfer TCP congestion control behavior improved Longer connections with larger congestion windows Response time improved Avoids multiple, serial TCP handshakes New HTTP request header for controlling Connection: keep-alive Connection: close Portland State University CS 430P/530 Internet, Web & Cloud Systems
Per ersis sisten ent t HTTP TP connection nnection exa xample ple Client Client Server 0 RTT DAT Client sends HTTP request for HTML ACK Server reads from disk DAT 1 RTT ACK Client parses HTML DAT Client sends HTTP request for image Server reads from disk ACK DAT 2 RTT Image begins to arrive Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP exa xample ple Non-persistent HTTP/1.0 mashimaro <~> 9:11AM % nc -C chi-ni.com 80 GET / HTTP/1.0 Host: chi-ni.com HTTP/1.0 200 OK … Connection: close Content-Type: text/html <HTML> <HEAD> <TITLE>Jeannie's Web Site</TITLE> </HEAD> <BODY> <IMG SRC="./2007_06_11-09_31_40.jpg"> </BODY> </HTML> mashimaro <~> 9:21AM %
mashimaro <~> 9:20AM % nc -C chi-ni.com 80 GET / HTTP/1.1 Host: chi-ni.com Connection: keep-alive Persistent HTTP/1.1 HTTP/1.1 200 OK … Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html <HTML> <HEAD> <TITLE>Jeannie's Web Site</TITLE> </HEAD> <BODY> <IMG SRC="./2007_06_11-09_31_40.jpg"> </BODY> </HTML> GET /2007_06_11-09_31_40.jpg HTTP/1.1 Host: chi-ni.com Connection: close HTTP/1.1 200 OK Content-Length: 539 Connection: close Content-Type: image/jpeg ���� JFIFHH ���� C … mashimaro <~> 9:20AM %
Prob oblems lems wi with th HTTP/ TP/1.1 Serial delivery of objects Head-of-line object blocking Stall in one object prevents delivery of others Most useful information in first few bytes (layout info) Multiple connections allow incremental rendering of images Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP TP ope perat ration ion Want the best of both worlds Persistence Single TCP connection Parallel object delivery Ability to simultaneously retrieve embedded objects over connection Need application/object level demux within a single TCP connection to emulate multiple connections Leads us to SPDY (2009) and HTTP/2, then QUIC and HTTP/3 Portland State University CS 430P/530 Internet, Web & Cloud Systems
HTTP/2
HTTP/ TP/2 Two main improvements Multiplexed streams Server-push
HTTP/ TP/2 2 mu multiple tiplexed ed st strea eams ms HTTP/1.1 Pipelined, sequential operation • on each connection Must use multiple connections • HTTP/1.1 HTTP/2 to get parallel delivery of Sequential Multiplexed Client Server Client Server objects Typically, 4-8 outstanding • requests on 4-8 connections Still resource intensive on the • server HTTP/2 One connection, many • pipelined, concurrent requests Normally limited to 100 •
HTTP/ TP/2 2 mu multiple tiplexed ed st strea eams ms How? HTTP stream identifiers combined with range requests/responses Implemented as a framing protocol within HTTP Server labels data with the object it is for and the range of bytes within it Application-layer demultiplexing of object data Allows one to support pipelining but avoid HOL blocking Application specific solution to transport protocol problem.
De Demo mo http://http2.golang.org/gophertiles HTTP/1 Handshaking overhead, poor congestion control behavior, multiple RTT to request individual tiles Exacerbated with lossy/wireless links and long RTTs HTTP/2 One handshake, better congestion control behavior, tiles requested in single RTT
HTTP/ TP/2 2 se server er pu push sh HTTP/1.1 Client fetches origin page HTTP/1.1 Must parse base page for embedded objects before initiate TCP submitting subsequent requests connection for them RTT request Server often knows what client file will request next send RTT file parse and request embedded objects time time
Recommend
More recommend