Principles of Network Applications Transport Services Provided by the Internet PDF

Summary

These lecture notes cover principles of network applications and internet transport protocols, focusing on topics like TCP, UDP, and HTTP, as well as the Domain Name System (DNS).

Full Transcript

Principles of Network Applications Transport Services Provided by the Internet Class Activity TCP service: UDP service: Application Layer: 2-1 Principles of Network Applications Internet transport protocols s...

Principles of Network Applications Transport Services Provided by the Internet Class Activity TCP service: UDP service: Application Layer: 2-1 Principles of Network Applications Internet transport protocols services TCP service: UDP service: (User Datagram ▪ reliable transport between sending Protocol) and receiving process ▪ unreliable data transfer ▪ flow control: sender won’t between sending and receiving overwhelm receiver process ▪ congestion control: throttle sender ▪ does not provide: reliability, when network overloaded flow control, congestion control, timing, throughput ▪ does not provide: timing, minimum guarantee, security, or throughput guarantee, security connection setup. ▪ connection-oriented: setup required Q: why bother? Why between client and server processes is there a UDP? Application Layer: 2-2 Principles of Network Applications Internet transport protocols services application application layer protocol transport protocol file transfer/download FTP [RFC 959] TCP e-mail SMTP [RFC 5321] TCP Web documents HTTP 1.1 [RFC 7320] TCP Internet telephony SIP [RFC 3261], RTP [RFC TCP or UDP 3550], or proprietary streaming audio/video HTTP [RFC 7320], DASH TCP interactive games WOW, FPS (proprietary) UDP or TCP Application Layer: 2-3 Securing TCP Vanilla TCP & UDP sockets: TSL implemented in ▪ no encryption application layer ▪ cleartext passwords sent into socket ▪ apps use TSL libraries, that traverse Internet in cleartext (!) use TCP in turn Transport Layer Security (TLS) TLS socket API ▪ provides encrypted TCP connections ▪ cleartext sent into socket ▪ data integrity traverse Internet encrypted ▪ end-point authentication ▪ see Chapter 8 Application Layer: 2-4 Principles of Network Applications An application-layer protocol defines: ▪ types of messages exchanged, open protocols: e.g., request, response ▪ defined in RFCs, everyone ▪ message syntax: has access to protocol what fields in messages & definition how fields are delineated ▪ allows for interoperability ▪ message semantics ▪ e.g., HTTP, SMTP meaning of information in proprietary protocols: fields ▪ e.g., Skype ▪ rules for when and how processes send & respond to messages Application Layer: 2-5 Application layer: overview ▪ P2P applications ▪ Principles of network ▪ video streaming and content applications distribution networks ▪ Web and HTTP ▪ socket programming with ▪ E-mail, SMTP, IMAP UDP and TCP ▪ The Domain Name System DNS Application Layer: 2-6 Class Activity Study the following two concepts and present in groups ▪ Web and HTTP ▪ The Domain Name System DNS Application Layer: 2-7 Web and HTTP First, a quick review… ▪ web page consists of objects, each of which can be stored on different Web servers ▪ object can be HTML file, JPEG image, Java applet, audio file,… ▪ web page consists of base HTML-file which includes several referenced objects, each addressable by a URL, e.g., www.someschool.edu/someDept/pic.gif host name path name Each URL has two components: the hostname of the server that houses the object and the object’s path name. Application Layer: 2-8 HTTP overview HTTP: hypertext transfer protocol ▪ Web’s application layer protocol ▪ HTTP adopts client/server model: PC running client: A client may be a browser that Firefox browser requests, receives, (using HTTP protocol) and “displays” Web objects server running server: A server may be a Web server Apache Web sends (using HTTP protocol) objects server in response to requests OR it may be a general purpose server iPhone running Safari browser Application Layer: 2-9 HTTP overview (continued) HTTP uses TCP: HTTP is “stateless” ▪ client initiates TCP connection ▪ server maintains no (creates socket) to server, port 80 information about past client ▪ server accepts TCP connection requests from client aside protocols that maintain “state” ▪ HTTP messages (application-layer are complex! protocol messages) exchanged ▪ past history (state) must be between browser (HTTP client) and maintained Web server (HTTP server) ▪ if server/client crashes, their views ▪ TCP connection closed of “state” may be inconsistent, must be reconciled Application Layer: 2-10 HTTP connections: two types Non-persistent HTTP Persistent HTTP 1. TCP connection opened ▪TCP connection opened to 2. at most one object sent a server over TCP connection ▪multiple objects can be 3. TCP connection closed sent over single TCP connection between client, downloading multiple and that server objects required multiple ▪TCP connection closed connections Application Layer: 2-11 Non-persistent HTTP: example User enters URL: www.someSchool.edu/someDepartment/home.index (containing text, references to 10 jpeg images) 1a. HTTP client initiates TCP connection to HTTP server 1b. HTTP server at host (process) at www.someSchool.edu on www.someSchool.edu waiting for TCP port 80 connection at port 80 “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing URL) into TCP connection 3. HTTP server receives request message, socket. Message indicates forms response message containing time that client wants object requested object, and sends message someDepartment/home.index into its socket Application Layer: 2-12 Non-persistent HTTP: example (cont.) User enters URL: www.someSchool.edu/someDepartment/home.index (containing text, references to 10 jpeg images) 4. HTTP server closes TCP 5. HTTP client receives response connection. message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 6. Steps 1-5 repeated for each of 10 jpeg objects time Application Layer: 2-13 Non-persistent HTTP: response time RTT (definition): time for a small packet to travel from client to server and back initiate TCP connection HTTP response time (per object): RTT ▪ one RTT to initiate TCP connection request file ▪ one RTT for HTTP request and first few RTT time to bytes of HTTP response to return transmit ▪ object/file transmission time file received file time time Non-persistent HTTP response time = 2RTT+ file transmission time Application Layer: 2-14 Persistent HTTP (HTTP 1.1) Non-persistent HTTP issues: Persistent HTTP (HTTP1.1): ▪ requires 2 RTTs per object ▪ server leaves connection open after ▪ OS overhead for each TCP sending response connection ▪ subsequent HTTP messages ▪ browsers often open multiple between same client/server sent parallel TCP connections to over open connection fetch referenced objects in ▪ client sends requests as soon as it parallel encounters a referenced object ▪ as little as one RTT for all the referenced objects (cutting response time in half) Application Layer: 2-15 HTTP request message ▪ two types of HTTP messages: request, response ▪ HTTP request message: ASCII (human-readable format) The request line has three fields: the method field, the URL field, and the HTTP version field request line (GET, POST, HEAD commands) header lines carriage return, line feed at start of line indicates end of header lines * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-16 HTTP request message ▪ two types of HTTP messages: request, response ▪ HTTP request message: ASCII (human-readable format) carriage return character line-feed character request line (GET, POST, GET /index.html HTTP/1.1\r\n HEAD commands) Host: www-net.cs.umass.edu\r\n User-Agent: Firefox/3.6.10\r\n Accept: text/html,application/xhtml+xml\r\n header Accept-Language: en-us,en;q=0.5\r\n lines Accept-Encoding: gzip,deflate\r\n Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n Connection: keep-alive\r\n carriage return, line feed \r\n at start of line indicates end of header lines * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-17 HTTP request message: general format method sp URL sp version cr lf request line header field name value cr lf header ~ ~ ~ ~ lines header field name value cr lf cr lf ~ ~ entity body ~ ~ body Application Layer: 2-18 Other HTTP request messages POST method: HEAD method: ▪ web page often includes form ▪ requests headers (only) that input would be returned if specified ▪ user input sent from client to URL were requested with an server in entity body of HTTP HTTP GET method. POST request message PUT method: ▪ uploads new file (object) to server GET method (for sending data to server): ▪ completely replaces file that exists ▪ include user data in URL field of HTTP at specified URL with content in GET request message (following a ‘?’): entity body of POST HTTP request www.somesite.com/animalsearch?monkeys&banana message Application Layer: 2-19 Other HTTP request messages Application Layer: 2-20 HTTP response message status line (protocol status code status phrase) header lines data, e.g., requested HTML file * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-21 HTTP response message status line (protocol HTTP/1.1 200 OK\r\n status code status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n Server: Apache/2.0.52 (CentOS)\r\n Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n header ETag: "17dc6-a5c-bf716880"\r\n Accept-Ranges: bytes\r\n lines Content-Length: 2652\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=ISO-8859- 1\r\n \r\n data data data data data... data, e.g., requested HTML file * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-22 HTTP response message Application Layer: 2-23 HTTP response status codes ▪ status code appears in 1st line in server-to-client response message. ▪ some sample codes: 200 OK request succeeded, requested object later in this message 301 Moved Permanently requested object moved, new location specified later in this message (in Location: field) 400 Bad Request request msg not understood by server 404 Not Found requested document not found on this server 505 HTTP Version Not Supported Application Layer: 2-24 Maintaining user/server state: cookies a stateful protocol: client makes Recall: HTTP GET/response two changes to X, or none at all interaction is stateless X ▪ no notion of multi-step exchanges of HTTP messages to complete a Web X “transaction” no need for client/server to track X’ “state” of multi-step exchange t’ all HTTP requests are independent of X’’ each other no need for client/server to “recover” X’’ from a partially-completed-but-never- time time completely-completed transaction Q: what happens if network connection or client crashes at t’ ? Application Layer: 2-27 Maintaining user/server state: cookies Web sites and client browser use Example: cookies to maintain some state ▪ Susan uses browser on laptop, visits specific e-commerce site between transactions for first time four components: ▪ when initial HTTP requests 1) cookie header line of HTTP response arrives at site, site creates: message unique ID (aka “cookie”) entry in backend database 2) cookie header line in next HTTP for ID request message subsequent HTTP requests 3) cookie file kept on user’s host, from Susan to this site will managed by user’s browser contain cookie ID value, 4) back-end database at Web site allowing site to “identify” Susan Application Layer: 2-28 Maintaining user/server state: cookies client server ebay 8734 usual HTTP request msg Amazon server cookie file creates ID usual HTTP response 1678 for user backend create ebay 8734 set-cookie: 1678 entry database amazon 1678 usual HTTP request msg cookie: 1678 cookie- access specific usual HTTP response msg action one week later: access ebay 8734 usual HTTP request msg amazon 1678 cookie: 1678 cookie- specific usual HTTP response msg action time time Application Layer: 2-29 HTTP cookies: comments aside What cookies can be used for: cookies and privacy: ▪ authorization ▪ cookies permit sites to ▪ shopping carts learn a lot about you on their site. ▪ recommendations ▪ third party persistent ▪ user session state (Web e-mail) cookies (tracking cookies) allow common identity (cookie value) to be Challenge: How to keep state: tracked across multiple ▪ protocol endpoints: maintain state at web sites sender/receiver over multiple transactions ▪ cookies: HTTP messages carry state Application Layer: 2-30 Web caches (proxy servers) Goal: satisfy client request without involving origin server ▪ user configures browser to point to a Web cache proxy ▪ browser sends all HTTP server requests to cache client origin if object in cache: cache server returns object to client else cache requests object from origin server, caches received object, then client returns object to client origin server Application Layer: 2-31 Web caches (proxy servers) ▪ Web cache acts as both Why Web caching? client and server ▪ reduce response time for client server for original request requesting client cache is closer to client client to origin server ▪ reduce traffic on an institution’s ▪ typically cache is access link installed by ISP (university, company, residential ISP) Application Layer: 2-32 Caching example Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Average request rate from browsers to origin servers: 15/sec ▪ average data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link problem: large ▪ LAN utilization:.0015 delays at high institutional network ▪ access link utilization =.97 utilization! 1 Gbps LAN ▪ end-end delay = Internet delay + access link delay + LAN delay = 2 sec + ? + usecs Application Layer: 2-33 Caching example Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Average request rate from browsers to origin servers: 15/sec ▪ average data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link Transmission delay over the access link and LAN: institutional network 1 Gbps LAN Application Layer: 2-34 Caching example: buy a faster access link Scenario: 154 Mbps ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Avg request rate from browsers to origin servers: 15/sec ▪ avg data rate to browsers: 1.50 Mbps 154 Mbps 1.54 Mbps Performance: access link ▪ LAN utilization: ? institutional network ▪ access link utilization = ? 1 Gbps LAN ▪ end-end delay = Internet delay + access link delay + LAN delay = 2 sec + minutes + usecs Cost: faster access link (expensive!) msecs Application Layer: 2-36 Caching example: install a web cache Scenario: ▪ access link rate: 1.54 Mbps origin ▪ RTT from institutional router to server: 2 sec servers ▪ Web object size: 100K bits public Internet ▪ Avg request rate from browsers to origin servers: 15/sec ▪ avg data rate to browsers: 1.50 Mbps 1.54 Mbps Performance: access link ▪ LAN utilization:.? How to compute link institutional network ▪ access link utilization = ? utilization, delay? 1 Gbps LAN ▪ average end-end delay = ? Cost: web cache (cheap!) local web cache Application Layer: 2-38 Caching example: install a web cache Calculating access link utilization, end- end delay with cache: origin ▪ suppose cache hit rate is 0.4: 40% requests servers satisfied at cache, 60% requests satisfied at public Internet origin ▪ access link: 60% of requests use access link ▪ data rate to browsers over access link 1.54 Mbps = 0.6 * 1.50 Mbps =.9 Mbps access link ▪ utilization = 0.9/1.54 =.58 institutional network ▪ average end-end delay 1 Gbps LAN = 0.6 * (delay from origin servers) + 0.4 * (delay when satisfied at cache) = 0.6 (2.01) + 0.4 (~msecs) = ~ 1.2 secs local web cache lower average end-end delay than with 154 Mbps link (and cheaper too!) Application Layer: 2-39 Conditional GET client server Goal: don’t send object if cache has HTTP request msg up-to-date cached version If-modified-since: object not no object transmission delay modified lower link utilization HTTP response before HTTP/1.0 ▪ cache: specify date of cached copy 304 Not Modified in HTTP request If-modified-since: HTTP request msg ▪ server: response contains no If-modified-since: object object if cached copy is up-to-date: modified HTTP response after HTTP/1.0 304 Not Modified HTTP/1.0 200 OK Application Layer: 2-40 HTTP/2 Key goal: decreased delay in multi-object HTTP requests HTTP1.1: introduced multiple, pipelined GETs over single TCP connection ▪ server responds in-order (FCFS: first-come-first-served scheduling) to GET requests ▪ with FCFS, small object may have to wait for transmission (head-of- line (HOL) blocking) behind large object(s) ▪ loss recovery (retransmitting lost TCP segments) stalls object transmission Application Layer: 2-41 HTTP/2 Key goal: decreased delay in multi-object HTTP requests HTTP/2: [RFC 7540, 2015] increased flexibility at server in sending objects to client: ▪ methods, status codes, most header fields unchanged from HTTP 1.1 ▪ transmission order of requested objects based on client-specified object priority (not necessarily FCFS) ▪ push unrequested objects to client ▪ divide objects into frames, schedule frames to mitigate HOL blocking Application Layer: 2-42 HTTP/2: mitigating HOL blocking HTTP 1.1: client requests 1 large object (e.g., video file, and 3 smaller objects) server GET O4 GET O3 GET O 2 GET O1 object data requested client O1 O2 O1 O3 O2 O3 O4 O4 objects delivered in order requested: O2, O3, O4 wait behind O1 Application Layer: 2-43 HTTP/2: mitigating HOL blocking HTTP/2: objects divided into frames, frame transmission interleaved server GET O4 GET O3 GET O 2 GET O1 object data requested client O2 O4 O3 O1 O2 O3 O1 O4 O2, O3, O4 delivered quickly, O1 slightly delayed Application Layer: 2-44 HTTP/2 to HTTP/3 Key goal: decreased delay in multi-object HTTP requests HTTP/2 over single TCP connection means: ▪ recovery from packet loss still stalls all object transmissions as in HTTP 1.1, browsers have incentive to open multiple parallel TCP connections to reduce stalling, increase overall throughput ▪ no security over vanilla TCP connection ▪ HTTP/3: adds security , per object error- and congestion- control (more pipelining) over UDP more on HTTP/3 in transport layer Application Layer: 2-45 Application layer: overview ▪ P2P applications ▪ Principles of network ▪ video streaming and content applications distribution networks ▪ Web and HTTP ▪ socket programming with ▪ E-mail, SMTP, IMAP UDP and TCP ▪ The Domain Name System DNS Application Layer: 2-46 outgoing E-mail message queue user mailbox user Three major components: agent ▪ user agents mail user server ▪ mail servers agent ▪ simple mail transfer protocol: SMTP SMTP mail user server agent SMTP User Agent SMTP user ▪ a.k.a. “mail reader” mail agent server ▪ composing, editing, reading mail messages user ▪ e.g., Outlook, iPhone mail client agent user ▪ outgoing, incoming messages stored on agent server Application Layer: 2-47 outgoing E-mail: mail servers message queue user mailbox user mail servers: agent ▪ mailbox contains incoming mail server user agent messages for user SMTP mail user ▪ message queue of outgoing (to server agent be sent) mail messages SMTP ▪ SMTP protocol between mail SMTP user agent servers to send email messages mail server client: sending mail server user agent “server”: receiving mail server user agent Application Layer: 2-48 E-mail: the RFC (5321) Application Layer: 2-49 Scenario: Alice sends e-mail to Bob 1) Alice uses UA to compose e-mail 4) SMTP client sends Alice’s message message “to” [email protected] over the TCP connection 2) Alice’s UA sends message to her 5) Bob’s mail server places mail server; message placed in the message in Bob’s message queue mailbox 3) client side of SMTP opens TCP 6) Bob invokes his user connection with Bob’s mail server agent to read message 1 user mail user mail agent agent server server 2 3 6 4 5 Alice’s mail server Bob’s mail server Application Layer: 2-50 Sample SMTP interaction S: 220 hamburger.edu C: HELO crepes.fr S: 250 Hello crepes.fr, pleased to meet you C: MAIL FROM: S: 250 [email protected]... Sender ok C: RCPT TO: S: 250 [email protected]... Recipient ok C: DATA S: 354 Enter mail, end with "." on a line by itself C: Do you like ketchup? C: How about pickles? C:. S: 250 Message accepted for delivery C: QUIT S: 221 hamburger.edu closing connection Application Layer: 2-51 Application Layer: Overview ▪ P2P applications ▪ Principles of network ▪ video streaming and content applications distribution networks ▪ Web and HTTP ▪ socket programming with ▪ E-mail, SMTP, IMAP UDP and TCP ▪ The Domain Name System DNS Application Layer: 2-56 DNS: Domain Name System people: many identifiers: SSN, name, passport # Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., cs.umass.edu - used by humans Q: how to map between IP address and name, and vice versa ? Application Layer: 2-58 DNS: Domain Name System people: many identifiers: Domain Name System: SSN, name, passport # A centralized database Internet hosts, routers: IP address (32 bit) - used for addressing datagrams “name”, e.g., cs.umass.edu - used by humans Q: how to map between IP address and name, and vice versa ? Application Layer: 2-59 DNS: Domain Name System Application Layer: 2-60 DNS: Domain Name System Domain Name System provides following services: 1. Hostname to ip address translation Application Layer: 2-61 DNS: Domain Name System Domain Name System provides following services: 2. Host aliasing Uses aliases for canonical (real) name as: relayI.west-coast.yahoo.com for yahoo.com Application Layer: 2-62 DNS: Domain Name System Domain Name System provides following services: 3. Load distribution If there are multiple yahoo servers and multiple clients are accessing these servers, DNS manage load distribution to avoid overloading of a specific server. Normally DNS pick first IP address as shown After accessing the first IP address the DNS server reshuffle the IP addresses as: Application Layer: 2-63 DNS: Domain Name System Domain Name System provides following services: 3. Load distribution Application Layer: 2-64 DNS: services, structure Domain Name System: Q: Why not centralize DNS? ▪ distributed database implemented in ▪ single point of failure hierarchy of many name servers ▪ traffic volume ▪ application-layer protocol: hosts, ▪ distant centralized database name servers communicate to resolve ▪ Maintenance names (address/name translation) ▪ Security note: core Internet function, implemented as application-layer ▪ Because of these reasons we protocol have to opt Distributed DNS (distributed database ) ▪ (Next slide) Application Layer: 2-65 Distributed database Application Layer: 2-66 DNS: a distributed, hierarchical database Root DNS Servers Root … ….com DNS servers.org DNS servers.edu DNS servers Top Level Domain … … … … yahoo.com amazon.com pbs.org nyu.edu umass.edu DNS servers DNS servers DNS servers DNS servers DNS servers Authoritative Client wants IP address for www.amazon.com; 1st approximation: ▪ client queries root server to find.com DNS server ▪ client queries.com DNS server to get amazon.com DNS server ▪ client queries amazon.com DNS server to get IP address for www.amazon.com Application Layer: 2-67 DNS: root name servers Application Layer: 2-68 TLD: authoritative servers Top-Level Domain (TLD) servers: ▪ responsible for.com,.org,.net,.edu,.aero,.jobs,.museums, and all top-level country domains, e.g.:.cn,.uk,.fr,.ca,.jp ▪ Network Solutions: authoritative registry for.com,.net TLD ▪ Educause:.edu TLD Authoritative DNS servers: ▪ organization’s own DNS server(s), providing authoritative hostname to IP mappings for organization’s named hosts ▪ can be maintained by organization or service provider Application Layer: 2-69 Local DNS name servers ▪ Does not strictly belong to DNS hierarchy ▪ Each ISP (residential ISP, company, university) has one also called “default name server” ▪ When host makes DNS query, query is sent to its local DNS server has local cache of recent name-to-address translation pairs (but may be out of date!) acts as proxy, forwards query into hierarchy Application Layer: 2-70 DNS name resolution: iterated query root DNS server Example: host at engineering.nyu.edu wants IP address for gaia.cs.umass.edu 2 3 TLD DNS server Iterated query: 1 4 ▪ contacted server replies 8 5 with name of server to requesting host at local DNS server contact engineering.nyu.edu dns.nyu.edu gaia.cs.umass.edu ▪ “I don’t know this name, 7 6 but ask this server” authoritative DNS server dns.cs.umass.edu Application Layer: 2-71 DNS name resolution: iterated query Application Layer: 2-72 DNS name resolution: recursive query root DNS server Example: host at engineering.nyu.edu wants IP address for gaia.cs.umass.edu 2 3 7 6 Recursive query: 1 TLD DNS server ▪ puts burden of name 8 resolution on requesting host at local DNS server 5 4 engineering.nyu.edu dns.nyu.edu contacted name gaia.cs.umass.edu server ▪ heavy load at upper authoritative DNS server levels of hierarchy? dns.cs.umass.edu Application Layer: 2-73 File distribution: client-server vs P2P Q: how much time to distribute file (size F) from one server to N peers? peer upload/download capacity is limited resource us: server upload capacity di: peer i download file, size F u1 d1 u2 capacity us d2 server di uN network (with abundant bandwidth) ui dN ui: peer i upload capacity Introduction: 1-74

Use Quizgecko on...
Browser
Browser