1 / 34

Peer-to-Peer Networks 13 Internet – The Underlay Network

This article provides an overview of congestion and flow control mechanisms in TCP/IP networks, including packet encapsulation, congestion prevention, TCP vs. UDP, TCP header structure, connection establishment, flow control, and retransmission. It also discusses the Nagle algorithm, IP routers dropping packets, and the impact of congestion on TCP.

eloyj
Download Presentation

Peer-to-Peer Networks 13 Internet – The Underlay Network

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. Christian Schindelhauer Technical Faculty Computer-Networks and Telematics University of Freiburg Peer-to-Peer Networks13 Internet – The Underlay Network

  2. Data/Packet Encapsulation Stevens, TCP/IP Illustrated 2

  3. Network Congestion • (Sub-)Networks have limited bandwidth • Injecting too many packets leads to • network congestion • network collapse Source B Gigabit Ethernet 2 Mbps DSL Link Gigabit Ethernet Destination Buffer overflow Source A 3

  4. Congestion and capacity 4

  5. Congestion Prevention 5

  6. Congestion Prevention by Routers • IP Routers drop packets • Tail dropping • Random Early Detection Source B Gigabit Ethernet 2 Mbps DSL Link X Gigabit Ethernet Destination X X Source A Packet deletion 6

  7. Random early detection (RED) • Packet dropping probability grows with queue length • Fairer than just “tail dropping”: the more a host transmits, the more likely it is that its packets are dropped P(drop) 1.0 MaxP AvgLen MinTh MaxTh 7

  8. TCP (Transmission Control Protocol connection-oriented delivers a stream of bytes reliable and ordered UDP (User Datagram Protocol) delivery of datagrams connectionless, unreliable, unordered end-to-end connection App App The Transport Layer Trans Trans Net Net Net Net Net Net Link Link Link Link Link Link Phy Phy Phy Phy Phy Phy Router Host Host Router 8

  9. TCP vs. UDP • TCP reduces data rate • UDP does not! UDP UDP Source B Gigabit Ethernet Destination B TCP 2 Mbps DSL Link TCP X Gigabit Ethernet X Source A Destination A 9

  10. Port addresses for parallel UDP connections Length data + header length Checksum for header and data UDP-Header • 0 7 8 15 16 23 24 31 • +--------+--------+--------+--------+ • | Source | Destination | • | Port | Port | • +--------+--------+--------+--------+ • | | | • | Length | Checksum | • +--------+--------+--------+--------+ • | • | data octets ... • +---------------- ... 10

  11. Connection-oriented Reliable delivery of a byte stream fragmentation and reassembly (TCP segments) acknowledgements and retransmission In-order delivery, duplicate detection sequence numbers Flow control and congestion control window-based (receiver window, congestion window) challenge: IP (network layer) packets can be dropped, delayed, delivered out-of-order ... The Transmission Control Protocol (TCP) 11

  12. TCP-Header • Sequence number • number of the first byte in the segment • bytes are numbered modulo 232 • Acknowledge number • activated by ACK-Flag • number of the next data byte • = last sequence number + last amount of data • Port addresses • for parallel TCP connections • TCP Header length • data offset • Check sum • for header and data 12

  13. Connection establishment and teardown by 3-way handshake TCP Connections Connection establishment Connection termination Host 1 Host 2 Host 1 Host 2 13

  14. Flow control and congestion control [Tanenbaum, Computer Networks] 14

  15. Flow Control acknowledgements and window management 15

  16. Retransmissions are triggered, if acknowledgements do not arrive ... but how to decide that? Measurement of the round trip time (RTT) Retransmissions DATA Network ACK 16

  17. Retransmissions and RTT Sender Receiver DATA Round Trip Time ACK DATA X Retransmission after timeout DATA 17

  18. Estimation of theRound Trip Time (RTT) • If no acknowledgement arrives before expiry of the Retransmission Timeout (RTO), the packet will be retransmitted • RTT not predictable, fluctuating • RTO derived from RTT estimation: • RFC 793: (M := last RTT measurement) • RTT ←α RTT + (1-α) M, where α = 0,9 • RTO ←β RTT, where β = 2 • Alternative by Jacobson 88 (using the deviation D): • D ←α’ D + (1-α’) |RTT - M| • RTT ←α RTT + (1-α) M • RTO ← RTT + 4D 18

  19. TCP - Algorithm of Nagle • How to ensure • small packages are shipped fast • yet, large packets are preferred • Algorithm of Nagle • Small packets are not sent, as long as acks are still pending • Package is small, if data length <MSS • when the acknowledgment of the last packet arrives, the next one is sent • Example: • terminal versus file transfer versus ftp • Feature: self-clocking: • Quick link = many small packets • slow link = few large packets 19

  20. IP Routers drop packets TCP has to react, e.g. lower the packet injection rate Congestion revisited TCP Source B Gigabit Ethernet 2 Mbps DSL Link TCP Destination Gigabit Ethernet X X X Source A Packet deletion 20

  21. Congestion revisited App App Trans Trans Net Net Net Net Net Net Congestion! Link Link Link Link Link Link Phy Phy Phy Phy Phy Phy Router Host Host Router from a transport layer perspective: ? ? App App ? no ACKs received Trans Trans Net Net Net Net Net Net Link Link Link Link Link Link Phy Phy Phy Phy Phy Phy Router Host Host Router 21

  22. Sender does not use the maximum segment size in the beginning Congestion window (cwnd) used on the sender size sending window: min {wnd,cwnd}(wnd = receiver window) S: segment size Initialization: cwnd ← S For each received acknowledgement: cwnd ← cwnd + S ...until a packet remains unacknowledged Data rate adaption and the congestion window Segment 1 ACK: Segment 1 Segment 2 Segment 3 ACK: Segment 3 Segment 4 Receiver Sender Segment 5 Segment 6 Segment 7 ACK: Segment 5 ACK: Segment 7 Segment 8 Segment 9 Segment 10 … 22

  23. Slow Start of TCP Tahoe slow start 23

  24. x ← 1 x ← x +1 y ← max y ← x/2 x ← 1 x ← 2⋅x, until x = y x: # Packets per RTT TCP Tahoe’s slow start • TCP Tahoe, Jacobson 88: • Congestion window (cwnd) • Slow Start Threshold (ssthresh) • S = maximum segment size • Initialization (after connection establishment): • cwnd ← S ssthresh ← 65535 • If a packet is lost (no acknowledgement within RTO): • multiplicative decrease of ssthreshcwnd ← S ssthresh ← • If a segment is acknowledged and cwnd ≤ ssthresh then • slow start: cwnd ← cwnd + S • If a segment is acknowledged and cwnd > ssthresh, then cwnd ← cwnd + S/cwnd 24

  25. x ← y + 3 y ← x/2 Fast Retransmit and Fast Recovery • TCP Tahoe [Jacobson 1988]: • If only one packet is lost • retransmit and use the rest of the window • Slow Start • Fast Retransmit • after three duplicate ACKs, retransmit Packet, start with Slow Start • TCP Reno [Stevens 1994] • After Fast Retransmit: • ssthresh ← min(wnd,cwnd)/2 • cwnd ← ssthresh + 3 S • Fast recovery after Fast retransmit • Increase window size by each single acknowledgement • cwnd ← cwnd + S • Congestion avoidance: if P+x is acknowledged: • cwnd ← ssthresh 25

  26. x ← x +1 x ← x/2 x ← 1 The AIMD principle • TCP uses basically the following mechanismto adapt the data rate x (#packets sent per RTT): • Initialization: • on packet loss: multiplicative decrease (MD) • if the acknowledgement for a segment arrives, perform additive increase (AI) 26

  27. AIMD additive increase multiplicative decrease 27

  28. Throughput and Latency knee cliff • Congested situation (cliff): • high load • low throughput • all data packets are lost • Desired situation (knee): • high load • high throughput • few data packets get lost max. bandwidth throughput (packets delivered) latency load (packets sent) 28

  29. Vector diagram for 2 participants b b: max. available bandwidth fairness data rate of A optimal data rate efficiency 0 data rate of B b 29

  30. AIAD Additive Increase/ Additive Decrease AI fairness data rate of A AD efficiency data rate of B

  31. MIMD: Multiplicative Incr./ Multiplicative Decrease MI fairness data rate of A MD efficiency data rate of B 31

  32. AIMD: Additively Increase/Multiplicatively Decrease AI fairness data rate of A MD efficiency data rate of B 32

  33. TCP - Conclusion • Connection-oriented, reliable, in-order delivery of a byte stream • Flow control and congestion control • Fairness among TCP streams • Unfair behavior of other protocols, e.g. UDP • Impact on latency • Tweaking the congestion avoidance mechanism has an impact on other applications 33

  34. Christian Schindelhauer Technical Faculty Computer-Networks and Telematics University of Freiburg Peer-to-Peer Networks13 Internet – The Underlay Network

More Related