EEC484584 Computer Networks Lecture 4 Wenbing Zhao wenbingieee
EEC-484/584 Computer Networks Lecture 4 Wenbing Zhao wenbing@ieee. org (Part of the slides are based on Drs. Kurose & Ross’s slides for their Computer Networking book)
2 • Wednesday, Lab 1 -HTTP – Homework: Lab 0 -Getting. Started • If you have access to a computer: Install wireshark, carry out all exercises, no need to submit report for lab 0 • If you don’t have access to a computer, at least read the instructions! • Lab report requirement: – Typed hardcopy, must include questions/tasks, your answers, and snapshots to backup your answers • Today’s topics – Principles of networked applications – Web and HTTP Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
3 Application Layer Protocols • Principles of networked applications – Client server model – Sockets – Addressing – Protocol – What do we need from transport layer? Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
4 Creating a Network Application • Write programs that – run on different end systems and – communicate over a network application transport network data link physical • No need to write code for devices in subnet – Subnet devices do not run user application code – application on end systems allows for rapid app development, propagation Fall Semester 2008 application transport network data link physical EEC-484/584: Computer Networks application transport network data link physical Wenbing Zhao
5 Inter-Process Communications • Process: program • Client process: running within a host process that initiates communication • Processes in different hosts communicate • Server process: by exchanging process that waits to messages be contacted More accurately, client and server should be regarded as the roles played by a process. A process can be both a client and a server Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
6 Sockets • Process sends/receives messages to/from its socket • For each point-to-point connection, there are two sockets, one on each side • API (Application Programming Interface): (1) choice of transport protocol; (2) ability to fix a few parameters Fall Semester 2008 host or server Controlled by app developer process socket TCP with buffers, variables Internet TCP with buffers, variables Controlled by OS EEC-484/584: Computer Networks Wenbing Zhao
7 Addressing • To receive messages, a process must have an identifier • Each host device has a unique 32 -bit IP address • Question: Does the IP address of the host on which the process runs suffice for identifying the process? Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
8 Addressing • Identifier includes both IP address and port numbers (16 -bit) associated with process on host • Example port numbers: – HTTP server: 80 – SSH server: 22 • To send HTTP request to academic. csuohio. edu Web server: – IP address: 137. 148. 49. 46 – Port number: 80 Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
9 Application Layer Protocol Defines • Types of messages exchanged – e. g. , request, response • Message syntax – what fields in messages & how fields are delineated • Message semantics – meaning of information in fields • Rules for when and how processes send & respond to messages Fall Semester 2008 Public-domain protocols: • defined in RFCs • allows for interoperability • e. g. , HTTP, SMTP Proprietary protocols: • e. g. , Ka. Za. A EEC-484/584: Computer Networks Wenbing Zhao
What Transport Service Does an Application Need? Data loss • some apps (e. g. , audio) can tolerate some loss • other apps (e. g. , file transfer, telnet) require 100% reliable data transfer Timing • some apps (e. g. , Internet telephony, interactive games) require low delay to be “effective” Fall Semester 2008 Bandwidth • some apps (e. g. , multimedia) require minimum amount of bandwidth to be “effective” • other apps (“elastic apps”) make use of whatever bandwidth they get EEC-484/584: Computer Networks Wenbing Zhao 10
11 The World Wide Web • Creation of Tim Berners-Lee, in 1989 CERN nuclear physics research – Mosaic – first graphical interface, creation of Marc Andersson (and others), precursor to Netscape • Uses a client-server architecture – Web server – Web browser • Runs on HTTP over TCP Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
12 Web and HTTP • Web page consists of objects • Object can be HTML file, JPEG image, Java applet, audio file, … • A Web page consists of a base HTML-file which includes several referenced objects • Each object is addressable by a URL • The idea of having one page point to another is called hypertext – Invented by Vannevar Bush, a MIT EE professor, in 1945 Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
13 URL – Uniform Resource Locater • Example URL: http: //www. someschool. edu/some. Dept/pic. gif protocol name host name path name • URL encodes three types of information – What is the page called – local path name uniquely indicating the specific page – Where is the page located – Host name of the server on which the page is located – How can the page be accessed – protocol, e. g. , http, ftp Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
14 Some Common URLs Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
15 HTTP Overview HTTP: Hyper. Text Transfer Protocol • Web’s application layer protocol • client/server model • HTTP 1. 0: RFC 1945 • HTTP 1. 1: RFC 2068 HT TP req ues PC running HT t TP res Explorer pon se st ue q e r P nse Server T o p running HT es r P T Apache Web HT server Mac running Navigator Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
16 HTTP Overview • Client initiates TCP connection (creates 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) • TCP connection closed Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
17 HTTP Overview • HTTP is “stateless” – Server maintains no information about past client requests • Protocols that maintain “state” are complex! – Past history (state) must be maintained – If server/client crashes, their views of “state” may be inconsistent, must be reconciled Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
18 HTTP Connections Nonpersistent HTTP • At most one object is sent over a TCP connection • HTTP/1. 0 uses nonpersistent HTTP Fall Semester 2008 Persistent HTTP • Multiple objects can be sent over single TCP connection between client and server • HTTP/1. 1 uses persistent connections in default mode EEC-484/584: Computer Networks Wenbing Zhao
Nonpersistent HTTP Suppose user enters URL 19 (contains text, references to 10 jpeg images) http: //www. some. School. edu/some. Dept/home. index 1 a. HTTP client initiates TCP connection to HTTP server at 1 b. HTTP server at host www. some. School. edu on port www. some. School. edu 80 waiting for TCP connection at port 80. “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing 3. HTTP server receives URL) into TCP connection request message, forms socket. Message indicates response message that client wants object containing requested object, some. Dept/home. index and sends message into its socket time Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
20 Nonpersistent HTTP 4. HTTP server closes TCP 5. HTTP client receives response time 6. connection. message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects Steps 1 -5 repeated for each of 10 jpeg objects Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
Non-Persistent HTTP: Response Time Definition of RTT: time to send a small packet to travel from client to server and back (Round Trip Time) initiate TCP connection RTT request file RTT file received time Fall Semester 2008 21 EEC-484/584: Computer Networks time to transmit file time Wenbing Zhao
Non-Persistent HTTP: Response Time 22 Response time: • one RTT to initiate TCP connection • one RTT for HTTP request and first few bytes of HTTP response to return • file transmission time Total = 2 RTT+transmit time Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
23 Non-Persistent HTTP Issues • Requires 2 RTTs per object • OS overhead for each TCP connection To reduce response time, browsers often open parallel TCP connections to fetch referenced objects Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
24 Persistent HTTP • Server leaves connection open after sending response • Subsequent HTTP messages between same client/server sent over open connection Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
25 Persistent HTTP 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 • Multiple requests are sent over the same connection concurrently. That is, after the first request, the second request is sent before the reply for the first request is received • As little as one RTT for all the referenced objects Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
26 HTTP Request Message • Two types of HTTP messages: request, response • HTTP request message: – ASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page. html HTTP/1. 1 Host: www. someschool. edu User-agent: Mozilla/4. 0 header Connection: close lines Accept-language: fr Carriage return, line feed indicates end of message Fall Semester 2008 (extra carriage return, line feed) EEC-484/584: Computer Networks Wenbing Zhao
HTTP Request Message: General Format 27 HTTP header is pure ASCII based. It is very different from lower layer protocols such as TCP, which is binary based Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
28 Method Types HTTP/1. 0 • GET • POST • HEAD HTTP/1. 1 • GET, POST, HEAD • PUT – Asks server to include only the header part in response – Uploads file in entity body to path specified in URL field • DELETE – Deletes file specified in the URL field Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
29 HTTP Response Message status line (protocol status code status phrase) header lines data, e. g. , requested HTML file Fall Semester 2008 HTTP/1. 1 200 OK Connection close Date: Thu, 06 Aug 1998 12: 00: 15 GMT Server: Apache/1. 3. 0 (Unix) Last-Modified: Mon, 22 Jun 1998 …. . . Content-Length: 6821 Content-Type: text/html data data. . . EEC-484/584: Computer Networks Wenbing Zhao
30 HTTP Response Status Codes Status code is in first line of the response message: 200 OK – request succeeded, requested object later in this message 301 Moved Permanently – requested object moved, new location specified later in this message (Location: ) 400 Bad Request – request message not understood by server 404 Not Found – requested document not found on this server 505 HTTP Version Not Supported Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
31 Trying out HTTP 1. Telnet to your favorite Web server: telnet cis. poly. edu 80 Opens TCP connection to port 80 (default HTTP server port) at cis. poly. edu. Anything typed in sent to port 80 at cis. poly. edu 2. Type in a GET HTTP request: GET /~ross/ HTTP/1. 1 Host: cis. poly. edu By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server 3. Look at response message sent by HTTP server! Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao
32 Web Caching Goal: satisfy client request without involving origin server • user sets browser: Web accesses via proxy server • browser sends all HTTP requests to proxy server – object in cache: returns cached object – else cache requests object from origin server, then returns object to client Fall Semester 2008 origin server HT client. HTTP TP req Proxy server ues t res pon se t s ue q re P nse o T p HT es r TP T H client EEC-484/584: Computer Networks est u q e Pr T nse o p HT res P T HT origin server Wenbing Zhao
33 More about Web Caching • Proxy server acts as both client and server • Typically proxy server is installed by ISP (university, company, residential ISP) Fall Semester 2008 Why Web caching? • Reduce response time for client request • Reduce traffic on an institution’s access link • Internet dense with caches: enables “poor” content providers to effectively deliver content EEC-484/584: Computer Networks Wenbing Zhao
Conditional GET: HTTP Build-in Support for Caching Proxy • Goal: don’t send object if server HTTP request msg cache is up-to-date If-modified-since: • Proxy server: specify date of <date> cached copy in HTTP response request HTTP/1. 0 If-modified-since: <date> • Origin server: response contains no object if cached copy is up-to-date: HTTP/1. 0 304 Not Modified Origin Server object not modified 304 Not Modified HTTP request msg If-modified-since: <date> HTTP response object modified HTTP/1. 0 200 OK <data> Fall Semester 2008 EEC-484/584: Computer Networks Wenbing Zhao 34
35 Non-Caching Example origin servers Assumptions • Average object size = 100, 000 bits • Avg. request rate from institution’s browsers to origin servers = 15/sec • Delay from institutional router to any origin server and back to router = 2 sec Fall Semester 2008 public Internet 1. 5 Mbps access link institutional network EEC-484/584: Computer Networks 10 Mbps LAN Wenbing Zhao
36 Non-Caching Example origin servers Consequences • Utilization on LAN = 15% • Utilization on access link = 100% • Total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + milliseconds Fall Semester 2008 public Internet 1. 5 Mbps access link institutional network EEC-484/584: Computer Networks 10 Mbps LAN Wenbing Zhao
37 Non-Caching Example origin servers Possible solution • Increase bandwidth of access link to, say, 10 Mbps public Internet Consequences • Utilization on LAN = 15% • Utilization on access link = 15% • Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs • Often a costly upgrade Fall Semester 2008 10 Mbps access link institutional network EEC-484/584: Computer Networks 10 Mbps LAN Wenbing Zhao
38 Caching Example origin servers Install proxy server • Suppose hit rate is 0. 4 Consequence • 40% requests will be satisfied almost immediately • 60% requests satisfied by origin server public Internet • Utilization of access link reduced to 60%, resulting in negligible delays (say 10 msec) institutional network • Total avg delay = Internet delay + access delay + LAN delay =. 6*(2. 01) secs +. 4*milliseconds < 1. 4 secs Fall Semester 2008 EEC-484/584: Computer Networks 1. 5 Mbps access link 10 Mbps LAN Institutional Proxy server Wenbing Zhao
- Slides: 38