1 / 44

Lecture 9

Lecture 9. Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012. CS3516: These slides are generated from those made available by the authors of our text. 3.5 connection-oriented transport: TCP segment structure reliable data transfer

jin
Télécharger la présentation

Lecture 9

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 9 Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith RossAddison-WesleyMarch 2012 CS3516: These slides are generated from those made available by the authors of our text. Introduction

  2. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline TransportLayer

  3. flow control application OS receiver controls sender, so sender won’t overflow receiver’s buffer by transmitting too much, too fast TCP socket receiver buffers TCP flow control application process application may remove data from TCP socket buffers …. … slower than TCP receiver is delivering (sender is sending) TCP code IP code from sender receiver protocol stack TransportLayer

  4. receiver “advertises” free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via socket options (typical default is 4096 bytes) many operating systems autoadjust RcvBuffer sender limits amount of unacked (“in-flight”) data to receiver’s rwnd value guarantees receive buffer will not overflow buffered data free buffer space TCP flow control to application process RcvBuffer rwnd TCP segment payloads receiver-side buffering TransportLayer

  5. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline TransportLayer

  6. before exchanging data, sender/receiver “handshake”: agree to establish connection (each knowing the other willing to establish connection) agree on connection parameters Connection Management application application • connection state: ESTAB • connection variables: • seq # client-to-server • server-to-client • rcvBuffer size • at server,client • connection state: ESTAB • connection Variables: • seq # client-to-server • server-to-client • rcvBuffer size • at server,client network network Socket clientSocket = newSocket("hostname","port number"); Socket connectionSocket = welcomeSocket.accept(); TransportLayer

  7. the well-known “two-army problem” The red armies together can defeat the blue army, but separately the blue army wins. Q: how can the 2 red armies agree on an attack time? • Fact: the one who sends a message does not know whether the message is delivered • Basic rule: one cannot send an ACK to acknowledge an ACK – it goes on forever. Blue army Red army Red army CS118

  8. client state server state LISTEN LISTEN choose init seq num, x send TCP SYN msg SYNSENT SYNbit=1, Seq=x choose init seq num, y send TCP SYNACK msg, acking SYN SYN RCVD SYNbit=1, Seq=y ACKbit=1; ACKnum=x+1 received SYNACK(x) indicates server is live; send ACK for SYNACK; this segment may contain client-to-server data ESTAB ACKbit=1, ACKnum=y+1 received ACK(y) indicates client is live TCP 3-way handshake ESTAB Syn Ack TransportLayer

  9. client, server each close their side of connection send TCP segment with FIN bit = 1 respond to received FIN with ACK on receiving FIN, ACK can be combined with own FIN simultaneous FIN exchanges can be handled TCP: closing a connection TransportLayer

  10. clientSocket.close() FINbit=1, seq=x FIN_WAIT_1 can no longer send but can receive data CLOSE_WAIT ACKbit=1; ACKnum=x+1 can still send data FIN_WAIT_2 wait for server close LAST_ACK FINbit=1, seq=y can no longer send data TIMED_WAIT ACKbit=1; ACKnum=y+1 timed wait for 2*max segment lifetime CLOSED CLOSED TCP: closing a connection client state server state ESTAB ESTAB Fin Ack TransportLayer

  11. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline TransportLayer

  12. congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) a top-10 problem! Principles of congestion control TransportLayer

  13. two senders, two receivers one router, infinite buffers output link capacity: R no retransmission maximum per-connection throughput: R/2 R/2 lout delay lin R/2 lin R/2 Causes/costs of congestion: scenario 1 original data: lin throughput:lout Host A unlimited shared output link buffers Host B • large delays as arrival rate, lin, approaches capacity TransportLayer

  14. one router, finite buffers sender retransmission of timed-out packet application-layer input = application-layer output: lin = lout transport-layer input includes retransmissions : lin lin Causes/costs of congestion: scenario 2 ‘ lin: original data lout l'in:original data, plus retransmitted data Host A finite shared output link buffers Host B TransportLayer

  15. idealization: perfect knowledge sender sends only when router buffers available R/2 lout lin R/2 Causes/costs of congestion: scenario 2 lin: original data lout copy l'in:original data, plus retransmitted data A free buffer space! finite shared output link buffers Host B TransportLayer

  16. Idealization: known loss packets can be lost, dropped at router due to full buffers sender only resends if packet known to be lost Causes/costs of congestion: scenario 2 lin: original data lout copy l'in:original data, plus retransmitted data A no buffer space! Host B TransportLayer

  17. Idealization: known loss packets can be lost, dropped at router due to full buffers sender only resends if packet known to be lost R/2 when sending at R/2, some packets are retransmissions but asymptotic goodput is still R/2 (why?) lout lin R/2 Causes/costs of congestion: scenario 2 lin: original data lout l'in:original data, plus retransmitted data A free buffer space! Host B TransportLayer

  18. when sending at R/2, some packets are retransmissions including duplicated that are delivered! lin timeout Causes/costs of congestion: scenario 2 Realistic: duplicates • packets can be lost, dropped at router due to full buffers • sender times out prematurely, sending twocopies, both of which are delivered R/2 lout R/2 lin lout copy l'in A free buffer space! Host B TransportLayer

  19. when sending at R/2, some packets are retransmissions including duplicated that are delivered! lin Causes/costs of congestion: scenario 2 Realistic: duplicates • packets can be lost, dropped at router due to full buffers • sender times out prematurely, sending twocopies, both of which are delivered R/2 lout R/2 “costs” of congestion: • more work (retrans) for given “goodput” • unneeded retransmissions: link carries multiple copies of pkt • decreasing goodput TransportLayer

  20. four senders multihop paths timeout/retransmit Causes/costs of congestion: scenario 3 Q:what happens as linand lin’ increase ? A:as red lin’ increases, all arriving blue pkts at upper queue are dropped, blue throughput g 0 lout Host A lin: original data Host B l'in:original data, plus retransmitted data finite shared output link buffers Host D Host C TransportLayer

  21. Causes/costs of congestion: scenario 3 C/2 lout lin’ C/2 another “cost” of congestion: • when packet dropped, any “upstream transmission capacity used for that packet was wasted! TransportLayer

  22. end-end congestion control: no explicit feedback from network congestion inferred from end-system observed loss, delay approach taken by TCP network-assisted congestion control: routers provide feedback to end systems single bit indicating congestion (SNA, DECbit, TCP/IP ECN, ATM) explicit rate for sender to send at Approaches towards congestion control two broad approaches towards congestion control: TransportLayer

  23. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline 4.5 routing algorithms • link state • distance vector • hierarchical routing TransportLayer

  24. TCP congestion control: additive increase multiplicative decrease • approach:senderincreases transmission rate (window size), probing for usable bandwidth, until loss occurs • additive increase: increase cwndby 1 MSS every RTT until loss detected • multiplicative decrease: cut cwnd in half after loss additively increase window size … …. until loss occurs (then cut window in half) AIMD saw tooth behavior: probing for bandwidth cwnd: TCP sender congestion window size time TransportLayer

  25. sender limits transmission: cwnd is dynamic, function of perceived network congestion TCP sending rate: roughly: send cwnd bytes, wait RTT for ACKS, then send more bytes < cwnd ~ ~ RTT TCP Congestion Control: details sender sequence number space cwnd last byte ACKed last byte sent sent, not-yet ACKed (“in-flight”) rate bytes/sec LastByteSent- LastByteAcked cwnd TransportLayer

  26. when connection begins, increase rate exponentially until first loss event: initially cwnd = 1 MSS double cwnd every RTT done by incrementing cwnd for every ACK received summary:initial rate is slow but ramps up exponentially fast time TCP Slow Start Host B Host A one segment RTT two segments four segments TransportLayer

  27. loss indicated by timeout: cwnd set to 1 MSS; window then grows exponentially (as in slow start) to threshold, then grows linearly loss indicated by 3 duplicate ACKs: TCP RENO dup ACKs indicate network capable of delivering some segments cwnd is cut in half window then grows linearly TCP Tahoe always sets cwnd to 1 (timeout or 3 duplicate acks) TCP: detecting, reacting to loss TransportLayer

  28. Q: when should the exponential increase switch to linear? A: when cwnd gets to 1/2 of its value before timeout. Implementation: variable ssthresh on loss event, ssthresh is set to 1/2 of cwndjust before loss event TCP: switching from slow start to CA TransportLayer

  29. new ACK . cwnd = cwnd+MSS dupACKcount = 0 transmit new segment(s), as allowed new ACK L cwnd = cwnd + MSS (MSS/cwnd) dupACKcount = 0 transmit new segment(s), as allowed cwnd = 1 MSS ssthresh = 64 KB dupACKcount = 0 cwnd > ssthresh L timeout ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment slow start congestion avoidance timeout dupACKcount == 3 dupACKcount == 3 ssthresh = cwnd/2 cwnd = 1 MSS dupACKcount = 0 retransmit missing segment timeout ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment duplicate ACK duplicate ACK ssthresh= cwnd/2 cwnd = ssthresh + 3 retransmit missing segment ssthresh = cwnd/2 cwnd = 1 dupACKcount = 0 retransmit missing segment dupACKcount++ dupACKcount++ fast recovery New ACK duplicate ACK cwnd = cwnd + MSS transmit new segment(s), as allowed New ACK! New ACK! New ACK! cwnd = ssthresh dupACKcount = 0 Summary: TCP Congestion Control TransportLayer

  30. 3 W avg TCP thruput = bytes/sec RTT 4 W W/2 TCP throughput • avg. TCP thruput as function of window size, RTT? • ignore slow start, assume always data to send • W: window size (measured in bytes) where loss occurs • avg. window size (# in-flight bytes) is ¾ W • avg. thruput is 3/4W per RTT TransportLayer

  31. . 1.22 MSS TCP throughput = RTT L TCP Futures: TCP over “long, fat pipes” • example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput • requires W = 83,333 in-flight segments • throughput in terms of segment loss probability, L [Mathis 1997]: ➜ to achieve 10 Gbps throughput, need a loss rate of L = 2·10-10 – a very small loss rate! • new versions of TCP for high-speed TransportLayer

  32. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline 4.5 routing algorithms • link state • distance vector • hierarchical routing TransportLayer

  33. routing algorithm determines end-end-path through network forwarding table determines local forwarding at this router 1 3 2 Interplay between routing, forwarding routing algorithm local forwarding table dest address output link address-range 1 address-range 2 address-range 3 address-range 4 3 2 2 1 IP destination address in arriving packet’s header Network Layer

  34. 5 3 5 2 2 1 3 1 2 1 z x w u v y Graph abstraction graph: G = (N,E) N = set of routers = { u, v, w, x, y, z } E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) } aside: graph abstraction is useful in other network contexts, e.g., P2P, where N is set of peers and E is set of TCP connections Network Layer

  35. 5 3 5 2 2 1 3 1 2 1 z x w u v y Graph abstraction: costs c(x,x’) = cost of link (x,x’) e.g., c(w,z) = 5 cost could always be 1, or inversely related to bandwidth, or inversely related to congestion cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp) key question: what is the least-cost path between u and z ? routing algorithm: algorithm that finds that least cost path Network Layer

  36. Q: global or decentralized information? global: all routers have complete topology, link cost info “link state” algorithms decentralized: router knows physically-connected neighbors, link costs to neighbors iterative process of computation, exchange of info with neighbors “distance vector” algorithms Q: static or dynamic? static: routes change slowly over time dynamic: routes change more quickly periodic update in response to link cost changes Routing algorithm classification Network Layer

  37. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management 3.6 principles of congestion control 3.7 TCP congestion control Lecture 9 outline 4.5 routing algorithms • link state • distance vector • hierarchical routing TransportLayer

  38. Dijkstra’s algorithm net topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info computes least cost paths from one node (‘source”) to all other nodes gives forwarding table for that node iterative: after k iterations, know least cost path to k dest.’s notation: c(x,y): link cost from node x to y; = ∞ if not direct neighbors D(v): current value of cost of path from source to dest. v p(v): predecessor node along path from source to v N': set of nodes whose least cost path definitively known A Link-State Routing Algorithm Network Layer

  39. Dijsktra’s Algorithm 1 Initialization: 2 N' = {u} 3 for all nodes v 4 if v adjacent to u 5 then D(v) = c(u,v) 6 else D(v) = ∞ 7 8 Loop 9 find w not in N' such that D(w) is a minimum 10 add w to N' 11 update D(v) for all v adjacent to w and not in N' : 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N' Network Layer

  40. Dijkstra’s algorithm: example 9 11,w 14,x 11,w ∞ ∞ ∞ 3,u 5,u 5,u 6,w 6,w 7,u 7 5 4 8 3 w u x v y z 2 3 4 7 10,v 14,x D(v) p(v) D(w) p(w) D(x) p(x) D(y) p(y) D(z) p(z) Step N' u 0 uw 1 uwx 2 uwxv 3 uwxvy 4 12,y uwxvyz 5 notes: • construct shortest path tree by tracing predecessor nodes • ties can exist (can be broken arbitrarily) Network Layer

  41. 5 3 5 2 2 1 3 1 2 1 z x w u v y Dijkstra’s algorithm: another example D(v),p(v) 2,u 2,u 2,u D(x),p(x) 1,u D(w),p(w) 5,u 4,x 3,y 3,y D(y),p(y) ∞ 2,x Step 0 1 2 3 4 5 N' u ux uxy uxyv uxyvw uxyvwz D(z),p(z) ∞ ∞ 4,y 4,y 4,y Network Layer

  42. z x w u y v destination link (u,v) v (u,x) x y (u,x) (u,x) w z (u,x) Dijkstra’s algorithm: example (2) resulting shortest-path tree from u: resulting forwarding table in u: Network Layer

  43. algorithm complexity:n nodes each iteration: need to check all nodes, w, not in N n(n+1)/2 comparisons: O(n2) more efficient implementations possible: O(nlogn) oscillations possible: e.g., support link cost equals amount of carried traffic: 2+e 0 0 0 1 1+e C C C C D D D D B B A B B A A A 2+e 2+e 0 0 1 1 1+e 1+e 0 0 0 0 given these costs, find new routing…. resulting in new costs given these costs, find new routing…. resulting in new costs given these costs, find new routing…. resulting in new costs Dijkstra’s algorithm, discussion 1 1+e 0 0 e 0 1 1 e initially Network Layer

  44. The End is Near!

More Related