1 / 36

EEC-484/584 Computer Networks

EEC-484/584 Computer Networks. Lecture 16 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer Networking book, and on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall). Outline. TCP Connection management

brian-russo
Download Presentation

EEC-484/584 Computer Networks

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. EEC-484/584Computer Networks Lecture 16 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on Drs. Kurose & Ross’s slides for their Computer Networking book, and on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall)

  2. Outline • TCP • Connection management • Reliable data transfer • Flow control • TCP transmission policy • Congestion control • Reminder: Quiz 4 • MW session: 11/27 Monday 2-4pm • TTh session: 11/28 Tuesday 4-6pm EEC-484/584: Computer Networks

  3. TCP Connection Management TCP sender, receiver establish “connection” before exchanging data segments • Initialize TCP variables: • Sequence numbers • Buffers, flow control info (e.g. RcvWindow) • Client: connection initiator Socket clientSocket = new Socket("hostname","port number"); • Server: contacted by client Socket connectionSocket = welcomeSocket.accept(); EEC-484/584: Computer Networks

  4. TCP Connection Management Three way handshake: Step 1:client host sends TCP SYN segment to server • specifies initial sequence number • no data Step 2:server host receives SYN, replies with SYN/ACK segment • server allocates buffers • specifies server initial sequence number Step 3: client receives SYN/ACK, replies with ACK segment, which may contain data EEC-484/584: Computer Networks

  5. TCP Connection Management client server Three way handshake: • SYN segment is considered as 1 byte • SYN/ACK segment is also considered as 1 byte accept connect SYN (seq=x) SYN/ACK (seq=y, ACK=x+1) ACK (seq=x+1, ACK=y+1) EEC-484/584: Computer Networks

  6. Closing a connection: client closes socket:clientSocket.close(); Step 1:client end system sends TCP FIN control segment to server Step 2:server receives FIN, replies with ACK. Closes connection, sends FIN. TCP Connection Management client server close FIN ACK close FIN ACK timed wait closed EEC-484/584: Computer Networks

  7. Step 3:client receives FIN, replies with ACK. Enters “timed wait” - will respond with ACK to received FINs Step 4:server, receives ACK. Connection closed. Note:with small modification, can handle simultaneous FINs TCP Connection Management client server closing FIN ACK closing FIN ACK timed wait closed closed EEC-484/584: Computer Networks

  8. TCP creates rdt service on top of IP’s unreliable service Pipelined segments Cumulative acks TCP uses single retransmission timer Retransmissions are triggered by: timeout events duplicate acks Initially consider simplified TCP sender: ignore duplicate acks ignore flow control, congestion control TCP Reliable Data Transfer EEC-484/584: Computer Networks

  9. Data rcvd from app: Create segment with sequence number seq # is byte-stream number of first data byte in segment start timer if not already running (think of timer as for oldest unacked segment) expiration interval: TimeOutInterval Timeout: retransmit segment that caused timeout restart timer Ack rcvd: If acknowledges previously unacked segments update what is known to be acked start timer if there are outstanding segment TCP Sender Events: EEC-484/584: Computer Networks

  10. Seq=92 timeout time TCP: Retransmission Scenarios Host A Host B Host A Host B Seq=92, 8 bytes data Seq=92, 8 bytes data Seq=100, 20 bytes data ACK=100 timeout X ACK=100 ACK=120 loss Seq=92, 8 bytes data Seq=92, 8 bytes data Sendbase = 100 SendBase = 120 ACK=120 Seq=92 timeout ACK=100 SendBase = 120 SendBase = 100 premature timeout lost ACK scenario time EEC-484/584: Computer Networks

  11. Host A Host B Seq=92, 8 bytes data ACK=100 Seq=100, 20 bytes data timeout X loss ACK=120 time Cumulative ACK scenario TCP Retransmission Scenarios SendBase = 120 EEC-484/584: Computer Networks

  12. TCP ACK Generation TCP Receiver action Delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK Immediately send single cumulative ACK, ACKing both in-order segments Immediately send duplicate ACK, indicating seq. # of next expected byte Immediate send ACK, provided that segment starts at lower end of gap Event at Receiver Arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed Arrival of in-order segment with expected seq #. One other segment has ACK pending Arrival of out-of-order segment higher-than-expect seq. # . Gap detected Arrival of segment that partially or completely fills gap EEC-484/584: Computer Networks

  13. Receive side of TCP connection has a receive buffer: Speed-matching service: matching the send rate to the receiving app’s drain rate TCP Flow Control Flow control: sender won’t overflow receiver’s buffer by transmitting too much, too fast • App process may be slow at reading from buffer EEC-484/584: Computer Networks

  14. (Suppose TCP receiver discards out-of-order segments) Spare room in buffer = RcvWindow = RcvBuffer-[LastByteRcvd - LastByteRead] Rcvr advertises spare room by including value of RcvWindow in segments Sender limits unACKed data to RcvWindow guarantees receive buffer doesn’t overflow TCP Flow Control EEC-484/584: Computer Networks

  15. TCP Transmission Policy • Window management not directly tied to ACKs • The sender can send new segments only if the receiver has room to receive them • What if the receiver’s window drops to 0 ? • Sender may not normally send segments with two exceptions • Exception 1: urgent data may be sent, e.g., to allow user to kill process running on the remote machine • Exception 2: sender may send a 1-byte segment to make the receiver re-announce the next byte expected and window size EEC-484/584: Computer Networks

  16. TCP Transmission Policy • Window management not directly tied to ACKs EEC-484/584: Computer Networks

  17. TCP Transmission Policy • Nagle’s algorithm • To address the 1-byte-at-a-time sender problem • Clark’s algorithm • To address the 1-byte-at-a-time receiver problem EEC-484/584: Computer Networks

  18. 1-byte-at-a-time Sender Problem • Sender sends 1 byte (e.g., typed one character in an editor) • A segment of 1 byte is sent to the remote machine (41-byte IP packet) • Remote machine acks immediately (40-byte IP packet) • Editor (in remote machine) program reads the received 1 byte, a windows update segment is sent to user (40-byte IP packet) • Editor program echoes the 1 byte received to the user terminal (41-byte IP packet) • In all, 162 bytes of bandwidth used, 4 segments are sent for each character typed EEC-484/584: Computer Networks

  19. Nagle’s Algorithm • When sender application passes data to TCP one byte at a time • Send first byte • Buffer the rest until first byte ACKed • Then send all buffered bytes in one TCP segment • Start buffering again until all ACKed • Implemented widely in TCP, can be disabled/enabled by using socket options • For some application, it is necessary to disable the Nagle’s algorithm, e.g., X Windows program over Internet, to avoid erratic mouse movement, etc. EEC-484/584: Computer Networks

  20. Silly Window Syndrome • When receiver application accepts data from TCP 1 byte at a time EEC-484/584: Computer Networks

  21. Clark’s Algorithm • Receiver should not send window update until • It can handle max segment size it advertised when connection established, or, • Its buffer is half empty, whichever is smaller • Sender should wait until • It has accumulated enough space in window to send full segment, or, • One containing at least half of receiver’s buffer size • Nagle’s algorithm and Clark’s algorithm are complementary EEC-484/584: Computer Networks

  22. 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) Principles of Congestion Control EEC-484/584: Computer Networks

  23. 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 sender should send at Approaches towards Congestion Control Two broad approaches towards congestion control EEC-484/584: Computer Networks

  24. TCP Congestion Control: Additive Increase, Multiplicative Decrease • Approach: increase transmission rate (window size), probing for usable bandwidth, until loss occurs • Additive increase: increase cwnd by 1 MSS every RTT until loss detected • Multiplicative decrease: cut cwnd in half after loss Saw tooth behavior: probing for bandwidth EEC-484/584: Computer Networks

  25. Sender limits transmission: LastByteSent-LastByteAcked  cwnd Roughly, cwnd is dynamic, function of perceived network congestion How does sender perceive congestion? loss event = timeout or 3 duplicate acks TCP sender reduces rate (cwnd) after loss event three mechanisms: AIMD slow start conservative after timeout events cwnd rate = Bytes/sec RTT TCP Congestion Control EEC-484/584: Computer Networks

  26. When connection begins, cwnd = 1 MSS Example: MSS = 500 bytes & RTT = 200 msec Initial rate = 20 kbps Available bandwidth may be >> MSS/RTT Desirable to quickly ramp up to respectable rate TCP Slow Start • When connection begins, increase rate exponentially fast until first loss event EEC-484/584: Computer Networks

  27. When connection begins, increase rate exponentially until first loss event: 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 A Host B one segment RTT two segments four segments EEC-484/584: Computer Networks

  28. Q: When should the exponential increase switch to linear? A: When cwnd gets to 1/2 of its value before timeout Implementation: Variable Threshold At loss event, Threshold is set to 1/2 of cwnd just before loss event Congestion Avoidance How to increase cwnd linearly:cwnd (new) = cwnd + mss*mss/cwnd EEC-484/584: Computer Networks

  29. After 3 duplicated ACKs: cwnd is cut in half window then grows linearly But after timeout event: cwnd instead set to 1 MSS window then grows exponentially to a threshold, then grows linearly Congestion Control Philosophy: • 3 dup ACKs indicates network capable of delivering some segments • timeout indicates a “more alarming” congestion scenario EEC-484/584: Computer Networks

  30. Summary: TCP Congestion Control • When cwnd is below Threshold, sender in slow-start phase, window grows exponentially • When cwnd is above Threshold, sender is in congestion-avoidance phase, window grows linearly • When a triple duplicate ACK occurs, Threshold set to cwnd/2 and cwnd set to Threshold • When timeout occurs, Threshold set to cwnd/2and cwnd is set to 1 MSS EEC-484/584: Computer Networks

  31. TCP Sender Congestion Control EEC-484/584: Computer Networks

  32. TCP Sender Congestion Control EEC-484/584: Computer Networks

  33. TCP Congestion Control EEC-484/584: Computer Networks

  34. Exercise • Suppose that the TCP congestion window is set to 18 KB and a timeout occurs. How big will the window be if the next four transmission bursts are all successful? Assume that the maximum segment size is 1 KB. EEC-484/584: Computer Networks

  35. Exercise EEC-484/584: Computer Networks

  36. Exercise Problem #3 EEC-484/584: Computer Networks

More Related