760 likes | 841 Views
Spring 2006 EE 5304/EETS 7304 Internet Protocols. Lecture 15. TCP - Part 3. Tom Oh Dept of Electrical Engineering taehwan@engr.smu.edu. Administrative Issues. We will have final exam next week (6:30PM May 9, 2006). Outline. TCP header options TCP for transactions RED.
E N D
Spring 2006 EE 5304/EETS 7304 Internet Protocols Lecture 15 TCP - Part 3 Tom Oh Dept of Electrical Engineering taehwan@engr.smu.edu
Administrative Issues • We will have final exam next week (6:30PM May 9, 2006)
Outline • TCP header options • TCP for transactions • RED
TCP Header Options 20-byte TCP header TCP header options Data Option kind Option length Option-dependent data 1 byte 1 byte Variable
TCP Header Options (cont) • Maximum segment size (MSS): • In first SYN segment, sender can specify largest segment that it is willing to receive • If not specified, default 536 bytes assumed (not including TCP/IP headers) Kind = 2 Length = 4 MSS 1 byte 1 byte 2 bytes
TCP Header Options (cont) • Window scale factor [RFC 1323]: • Specifies factor to shift advertised window field • Shift n means multiply by 2n (max. n = 14 allows window of 230 = 1 billion bytes) • Larger windows are better for routes with large bandwidth-delay products Kind = 3 Length = 3 Shift count 1 byte 1 byte 1 byte
TCP Header Options (cont) • Selective acknowledgements (SACK) [RFC 2018]: • TCP acknowledgements are cumulative • This option allows selective acknowledgement of non-continuous data, so sender knows exactly what needs to be retransmitted
TCP for Transactions • Short transactions might consist of only a query and reply (one packet each way) • UDP does not guarantee reliability, but TCP’s 3-way handshake to set up and clear connections will be wasteful • TCP for transactions (T/TCP) tries to keep TCP’s reliability and short-cut connection set-up for single packets • Uses new header option called CC (connection count) • CC is incremented for each new T/TCP connection from a host
TCP for Transactions (cont) • In best case, only 3 segments used T/TCP SYN, query, FIN, client CC Request to open connection with CC, pass query, and close; CC number should be increment of previously used CC numbers from this host T/TCP SYN, reply, ACK, FIN, server CC Request to open connection with CC, pass reply, ACK of FIN, and close; CC number should be increment of previously used CC numbers from this host ACK ACK of FIN
TCP for Transactions (cont) • Any packet loss results in time-out and retransmissions • CC allows duplicate packets to be detected • If server is not capable of T/TCP, it can resort to normal TCP 3-way handshake • T/TCP is not in common use yet
RED • Problem: TCP congestion avoidance algorithm will push network into losing a packet, then back off into slow start • TCP sources tend to become synchronized, going into slow start at same time 1. Buffer overflows, dropping packets TCP source • • • Router queue TCP source 4. Several sources back off at same time 2. Sources detect congestion after RTT 3. Buffer overflow continues in meantime, effecting several sources
RED (cont) Packet loss Retransmission timeouts TCP rates Sources are syncrhonized Slow start Packet loss Packet loss From queueing theory, irregular traffic rate will be bad - large queues and packet loss Severe overutilzation Aggregate source rate into queue Severe underutilzation
RED (cont) • RED (random early detection) attempts to break the synchronization by making sources back off at different times • No mechanism for explicit notification, so RED relies implicit feedback • Packet will be dropped at random (before buffer overflows), forcing a source to back off before others • Random for fairness • De-synchronizing the sources helps to smooth out aggregate source rate → reduce packet losses and increase throughputs
RED (cont) Packet loss Packet loss Packet loss TCP rates From queueing theory, smooth traffic rate will be good - small queues and packet loss Aggregate source rate into queue Out-of-sync sources result in smoother rate - more sources, more smooth
RED (cont) • RED keeps track of average queue length = smoothed recent history of queue length (to discount transient changes) • Probability of dropping packet (randomly) depends on average queue length 1 Pr(drop) MaxP MinThresh MaxThresh
RED (cont) • RED has been shown to be very effective with TCP • Widely supported in routers • But best choices for parameters (MaxP, MinThresh, MaxThresh) can be difficult to determine
Spring 2006 EE 5304/EETS 7304 Internet Protocols Lecture 15 Client-server, DNS, WWW, P2P Tom Oh Dept of Electrical Engineering taehwan@engr.smu.edu
Outline • Client-server applications • Domain Name System (DNS) • World Wide Web (WWW) • Peer to peer (P2P) protocols
Client-Server Applications • Client-server is most common way of organizing processes in a distributed system • Easy to understand, clean organization • Computers are clients or servers (or both) • A server is a process running a specific service, eg, file server, web server, name server • A client is a process that makes a request from server and waits for response Request Client Server Reply
Client-Server (cont) • Communications can be connectionless, eg, UDP/IP • Efficient but problems over WANs • If reply is missing, requests can be retransmitted, but reply might be just late → duplicate request can cause service to be done twice • Hard for client to tell what really happened • Reliable TCP/IP is usually used • Cost is 3-way handshake to establish and terminate connections just for 2 data packets • TCP for transactions (T/TCP) is efficient alternative
Application server Database server Client 3-Tiered Client-Server • 3-tiered architectures can have intermediaries that are both client and server • Commonly used in transaction processing (application server = transaction monitor coordinates all transactions across different data servers) Request operation Request data Reply data Reply result
Horizontal Distribution • Horizontal distribution: a client or server can be physically split into logically equivalent parts, usually for load balancing • Horizontal distribution of servers: example is replicated web servers (identical copies of web contents) for load balancing • Horizontal distribution of clients: peer-to-peer network (actually no server)
DNS (Domain Name System) • An application used by other applications, not by users • Example of middleware - works between applications and network • Translates between user-friendly host names (www.website.com) and IP addresses • Frees applications to use host names instead of IP addresses • Totally distributed and decentralized for scalability and reliability
DNS (cont) • In early days, central NIC (Network Info. Center) kept a flat (non-hierarchical) table of name-to-address bindings • New hosts were added manually • Updated list was mailed out every few days to be installed by local administrators • Did not scale well
DNS (cont) • 1984 Paul Mockapetris wrote RFCs 882, 883 for DNS and built a reference implementation, JEEVES • 1988 Kevin Dunlap wrote an implementation for BSD Unix, BIND (Berkeley Internet Name Domain) • Designed to be a distributed database • Local control is allowed over database segments (each segment holds part of total namespace) • Those with administrative responsibility for their domain names see no outside interference • Data from all database segments is accessible everywhere
DNS - Name Space • Database info. is robust (resilient against failures) and highly available (responsive) • Replicated for robustness • Cached for high availability • All names are elements of a name space • Name space can be represented by a labeled, directed graph
DNS - Name Space (cont) • 3 types of nodes: • Leaf node represents a named entity, and has no outgoing edges • Directory node has incoming and outgoing edges, each labeled with a name • Stores a directory table of outgoing edges = (edge label, node identifier) • Root node (usually single) has outgoing edges, no incoming edges
DNS - Name Space (cont) • Example
DNS - Name Space (cont) • Each path in graph is referred to by sequence of labels (path name) • Example: n0:<home, steen, mbox> or /home/steen/mbox • A path name starting from root node is an absolute path name • A path name starting from another node is a relative path name
DNS - Name Space (cont) • Common types of naming graphs: • Hierarchical: like a tree, every node has exactly one incoming edge and exactly one absolute path name • Directed acyclic graph: nodes can have multiple incoming edges, but graph cannot have a cycle
DNS - Name Space (cont) • DNS has a hierarchical name space • Example: path name = houns54.clearlake.ibm.com (root) root-level name net org com mil gov top-level name edu first-level name dell ibm hp second-level name clearlake third-level name houns54
DNS - Name Space (cont) • DNS hierarchy can be viewed in 3 layers Global layer: highest level nodes; stable (almost never changing) Administrative layer: groups belonging to same organization; relatively stable (change occasionally) Managerial layer: regularly changing, eg, shared files, user-defined directories; could be administered by end users - formally, not part of DNS
DNS - Servers • Zone is part of name space implemented in a name server • Although domains must be registered centrally, each domain can be arbitrarily subdivided into zones without registration • 3 types of DNS servers within a zone: • Primary DNS server or master server: • Only one primary within each zone • Keeps zone data file = snapshot of DNS database, which is read when DNS service starts up
DNS - Servers (cont) • Secondary DNS server or slave server: • Serve as redundant backup and load balancing • Gets its data from primary server in zone • Checks for updated info • Caching servers • Store recently accessed DNS records from other domains to avoid performance penalty to make a remote query each time to access a resource outside local domain
DNS - Servers (cont) • 15 root name servers act as top of DNS hierarchy worldwide • Ultimate source for name lookups that cannot be resolved otherwise • Designed to be highly reliable
DNS - Name Resolution • TCP/IP client can send name query (to resolve an address to name) or address query (to resolve a name to address) • This part of client is a name resolver • Must be configured with a local DNS server or learn one using DHCP • Example: query for www.foo.com goes to local DNS server • Unless cached, local DNS server queries a root server for IP address of .com DNS server
Resolver Cache DNS -Name Resolution (cont) • Local DNS server queries .com DNS server for IP address of foo.com DNS server, then queries this server for foo.com zone • Query goes to primary server in foo.com zone (or secondary server) • Example of “iterative name resolution” 2 Root server 3 Client 1. DNS Query Local DNS server 4 Top-level domain server 8. DNS Reply 5 6 Second-level domain server 7 37
World Wide Web • Web is most important example of distributed document-based system • 1965 Ted Nelson described idea of “hypertext” (text with hyperlinks) • 1989 WWW first proposed by Tim-Berners Lee at CERN for physicists to share hyperlinked data, prototyped on a NeXT cube • 1993 first graphical web browser Mosaic released by NCSA
WWW (cont) • 1994 Marc Andreessen founded Mosaic/Netscape, released Netscape Navigator • 1994 CERN and MIT joined to form World Wide Web Consortium (w3.org) to coordinate standards • Web traffic now accounts for 70+ percent Internet traffic
WWW Advantages • Simple graphical user interface instead of complex command line • Allows access to variety of resources (documents, graphics, programs) • Hyperlinks are easier to navigate (eg, compared to gopher) • Easy to use search engines • Web pages are easy to create and publish
HTTP HTTP TCP TCP IP IP WWW Basics: Client-Server DNS server 1. DNS query and reply Web client Web server 2. TCP SYN 3. HTTP request 4. HTTP response 5. TCP FIN
WWW Basics: Client-Server (cont) • Web browser (client) selects URL (uniform resource locator) to request • Browser parses domain name which must be translated into IP address • Sends domain name to one of local DNS servers • DNS server responds with IP address • Browser establishes TCP connection with web server • Parses URL for document name, sends HTTP request for document • Web server returns document → browser displays
HTTP Protocol • Exchange consists of an HTTP message pair = client request + server response • Stateless: client and server do not keep memory • Each exchange is treated as new • Keeps servers simple • By default, TCP is transport layer protocol to relieve HTTP from concerns about lost packets (and connection errors are reported)
HTTP (cont) • HTTP request contains method (operation) + document name + protocol version • Web server applies method in HTTP request and replies with HTTP response • Most common methods: • HTTP request contains method (operation) + document name + protocol version • Web server applies method in HTTP request and replies with HTTP response • Most common methods:
HTTP Request Message Format Mandatory Optional additional headers, eg, security info for authentication, client’s email address, date/time, acceptable language
HTTP Reply Message Format Status codes with explanatory phrase: 200 Request honored; 400 Bad request 403 Forbidden 404 Not found
Web Documents • Every resource is a “document” and usually identified by URL • URL = protocol + host name + (optional port number) + pathname • Example: http://www.cs.vu.nl:80/home/steen/index.html • Most documents in HTML (hypertext markup language) • Keywords specify structure of document in different sections/parts (header, lists, tables, forms,…) • Keywords also specify presentation and hyperlinks to other documents
Web Documents (cont) • Other types of documents
Web Difficulties • TCP connection set-up/close involves overhead for every Web interaction • Delays in reaching web server • Network latency depends on congestion • Rule of thumb - users will wait 8 sec for a document • Possible web server overload • Centralized servers do not scale well to large networks • Vulnerable to denial of service attacks • Possible abuse of cookies (state stored in client)
Web Enhancements: CGI • CGI (common gateway interface) allows a web server to execute a program with client input (usually a form) • Allows dynamic interaction with web server