TDC 562 :Computer Network Design & Analysis (Internet Engineering)
Lecture # 8: TCP Traffic
(Error Control and Flow Control) Dr. Ehab S. Al-Shaer
School of Computer Science & Telecommunications DePaul University Chicago, IL
1
Problem
? How
much traffic do you send? ? Two issues
• flow control: make sure that the sender does not overrun the receiver (receives as fast as you send) • congestion control: make sure that the sender does not overrun the network
2 Dr. Ehab Al-Shaer/Network Design & Analysis
1
TCP Acknowledgments
? Ack
number = last sequence received +1 ? Every TCP segment include a piggyback ack ? Ack is used as Nack
• example, seq# 100 is expected but seq 110 is received, then ACK#100 is sent • Ack indicates that the segment is received by the remote TCP but not necessary delivered to the application (but the win size might indicate this)
3 Dr. Ehab Al-Shaer/Network Design & Analysis
When Does TCP Send an Ack? (RFC 1122 and 2581)
Send Delayed Ack if 500 ms (at most) is elapsed after an in-order expected packet is arrived and all inprevious packet are already acked (no gabs) ? Send an Immediate Ack if one in -order segment is inreceived while a previously received segment has not been acked yet ? If pkt is received with seq > expected seq then ACK with expected seq must be sent ? If pkt is received to fill in the gap partially, then TCP sends Ack with the next Seq# fills in this gab ? If pkt is received to fill in the gap completely, then TCP sends Ack with the largest Seq# received ? Window update Ack (due to window increase or 4 decrease) -- inferred Al-Shaer/Network Design & Analysis Dr. Ehab
?
2
TCP Interactive Data Flow
? Interactive
Flow
• bursty data • e.g., telnet, rlogin, rsh • Example (Fig 19.1,2)
bsdi% rlogin svr4 => svr4% ... ? Delayed
Ack
• Ack times out in fixed intervals (200 ms) from the kernel bootstrap time • purpose:
– Ack more data – piggybacking
• Fig. 19.3
Dr. Ehab Al-Shaer/Network Design & Analysis
5
Nagle Algorithm for TCP Interactive Sessions
?
Concept:
• no segment is sent if there is more than ONE segment unacked yet
? ?
Applications
• for interactive sessions over WAN (large RTT)
Advantages
• self clocking: fast ack => fast data • reduces number tiny datagram sent over WAN • Example Fig 19.4
– 16 bytes (rlogin) are sent in 9 segments instead of 16 segments – No delayed Ack (why?) always there is data ready to be sent
6 Dr. Ehab Al-Shaer/Network Design & Analysis
3
Sliding Window Protocol
?
Algorithm
while (next < unack + win) transmit next packet; where win = min(cwnd, flow_win);
seq #
unack
next
win
?
Figures 20.4, 5, 6
7
Flow control: Window Size and Throughput
RTT (Round Trip Time)
? ? ? ?
SlidingSliding- window based flow control: higher window? higher window? throughput Throughput = wnd/RTT wnd/RTT window size control throughput
wnd = 3
segm ent 1 segm ent 2 segm ent 3
1 ACK 2 ACK 3 ACK
segm ent 4 segm ent 5 segm ent 6
8
4
TCP Bulk Data Flow and Window Interaction
? Sender
sends multiple segments then wait
for ack ? Data flow Examples
svr4% sock -I -n8 bsdi 7777
• Fig 20.1 (one way) and Fig 20.2 (another way) • Flow control: fast sender and slow receiver
– Fig 20.3:
– window advertisement (seg 8) & window update (seg 9)
9 Dr. Ehab Al-Shaer/Network Design & Analysis
TCP Bulk Data Flow Control
? Sliding
Window
• window closes when buffer is full • window opens when Ack is received (buffer freed) • sender can send less than the adv window size • receiver can send Ack before win filled up
– some implementation Ack after receiving two segs – delayed Ack
• Receiver window size affects the performance
– Example:
bsdi% sock -i -s -R6144 5555 sun% sock -I -n1 -w8192 bsdi 5555
10 Dr. Ehab Al-Shaer/Network Design & Analysis
5
TCP Bulk Data Flow Control
?
Push Flags
– asks TCP to deliver the segs immediately to the application – Not accessible from the socket API but TCP can decide when to use it
– Injecting pkts fast may cause routers congestion – injecting the pkts in the same rate acks are received (reflecting the link capacity and speed)
?
Slow Start
• Congestion Window (cwnd) Concept:
– imposed by the sender (adv win is imposed by recv) – start by sending ONE segments and increase the window size by one every time an Ack is received => exponential increase – cwnd is also decremented if re-transmission occurs (later in congestion avoidance)
• Example Figure 20.8
11
Dr. Ehab Al-Shaer/Network Design & Analysis
TCP Bulk Data Throughput
? Ideally,
max throughput is achieved when the pipe is filled up ? Example 20.9 and 20.10
• time 31 pipe is full => ideal + self clocking • Capacity= bandwidth(bit/sec)*RTT (sec) • Two factors affect the capacity
– delay (RTT or pipe length) – bandwidth – Example – T1: 1,544,000 x 60 ms = 11,580 bytes – T3: 45,000,000 x 60 ms = 337,500 bytes > max win size but TCP scale option is used to overcome this
12 Dr. Ehab Al-Shaer/Network Design & Analysis
6