0% found this document useful (0 votes)
13 views5 pages

Client Role in Congestion Avoidance

Uploaded by

ZteTems Opt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views5 pages

Client Role in Congestion Avoidance

Uploaded by

ZteTems Opt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Client Net Server

Client App Network

This sequence diagram was generated with EventStudio System Designer (http://www.EventHelix.com/EventStudio).

We have already seen that TCP connection starts up in slow start mode, geometrically increasing the congestion window
(cwnd) until it crosses the slow start threshold (ssthresh). Once cwnd is greater that ssthresh, TCP enters the congestion
avoidance mode of operation. In this mode, the primary objective is to maintain high throughput without causing congestion. If
TCP detects segment loss, it assumes that congestion has been detected over the internet. As a corrective action, TCP
reduces its data flow rate by reducing cwnd. After reducing cwnd, TCP goes back to slow start.

Socket initialization
Server awaits client socket connections.

Client socket initialization

create Client Client Application creates Socket


Socket

Closed The socket is created in the Closed state


seq_num = 0 Initial sequence number is set to 0

Active_Open Application wishes to communicate with a destination server


using a TCP connection. The application opens a socket for the
connection in active mode. In this mode, a TCP connection will
be attempted with the server.
Typically, the client will use a well known port number to
communicate with the remote Server. For example, HTTP uses
port 80.
Client initiated three way handshake to establish a
TCP connection
SYN Client sets the SYN bit in the TCP header to request a TCP
src = Client_Port, connection. The sequence number field is set to 0. Since the
dst = Server_Port, SYN bit is set, this sequence number is used as the initial
seq_num = 0 sequence number

SYN Sent Socket transitions to the SYN Sent state


SYN+ACK Client receives the "SYN+ACK" TCP segment
src = Server_Port,
dst = Client_Port,
seq_num = 100,
ack_num = 1,
window = 65535

ACK Client now acknowledges the first segment, thus completing the
src = Client_Port, three way handshake. The receive window is set to 5000. Ack
dst = Server_Port, sequence number is set to 101, this means that the next
ack_num = 101, expected sequence number is 101.
window = 5000

Established At this point, the client assumes that the TCP connection has
been established

Slow start
cwnd = 512 bytes (1 segment) TCP connection begins with a congestion window size of 1
segment
Client Net Server
Client App Client Network Server
Socket Socket

ssthresh = 65535 bytes The slow start threshold starts with 64 Kbytes as the threshold
value.
TCP session begins with 'Slow Start' Click on the action title for a detailed description of the TCP
slow start.
Slow Start Since cwnd < ssthresh, TCP state is slow start
TCP congestion window grows from 512 bytes (1 segment) to TCP congestion window grows at the start of the session if no
64947 segment losses are detected during slow start). During slow
start the congestion window was being incremented by 1
segment for every TCP Ack from the other end.
About to exit slow start
Data Client Application sends data for transmission over the TCP
Socket
TCP Segment Data is split into TCP Segments. The segments are sent over
seq_num = 100000, the Internet
len = 512

TCP Segment
seq_num = 100512,
len = 512

ACK
ack_num = 101024,
window = 80000

cwnd = 64947 + 512 = 65459 Since TCP is in slow start, every ack leads to the window
growing by one segment.

Congestion Avoidance
Congestion Avoidance At this point cwnd (=65459) > ssthresh (=65535) thus TCP
changes state to congestion avoidance. Now TCP window
growth will be much more conservative. If no segment or ack
losses are detected, the congestion window will grow no more
than one segment per roundtrip. (Compare this with geometric
growth of 1 segment per TCP ack in slow start)
Data More data is received from the client application
TCP Segment Client data is split into TCP segments
seq_num = 101024,
len = 512

TCP Segment
seq_num = 101536,
len = 512

ACK
ack_num = 102048,
window = 80000

cwnd is incremented using the formula: cwnd = cwnd +


(segment_size segment_size) / cwnd)

cwnd = 65459 + [(512 * 512) / Now TCP is in congestion avoidance mode, so the TCP window
65459] = 65459 + 4 = 65463 advances very slowly. Here the window increased by only 4
bytes.
Client Net Server
Client App Client Network Server
Socket Socket

Data Data to be sent to server


TCP Segment TCP session sends out the data as a single segment
seq_num = 102048,
len = 512

A TCP segment is lost


AckTimer TCP session starts a ack timer, awaiting the TCP ack for this
segment.
Note: The above timer is started for every segment. The timer is
not shown at other places as it does not play a role in our
analysis.
AckTimer TCP times out for a TCP ACK from the other end. This will be
treated as a sign of congestion by TCP
ssthresh = 65463/2 = 32731 When TCP detects congestion, it stores half of the current
congestion window in ssthresh variable. In this case, ssthresh
has been reduced from 65535 to 32731. This signifies that TCP
now has less confidence on the network's ability to support big
window sizes. Thus if the window size falls due to congestion,
rapid window size increases will be carried out only until the
window reaches 32731. Once this lowered ssthresh value is
reached, window growth will be much slower.

Back to slow start


cwnd = 512 bytes (1 segment) Since current congestion has been detected by timeout, TCP
takes the drastic action of reducing the congestion window to 1.
As you can see, this will have a big impact on the throughput.
Slow Start cwnd (=1) is now lower than ssthresh (=32731) so TCP goes
back to slow start.
TCP Segment
seq_num = 102048,
len = 512

ACK
ack_num = 102560

cwnd = 512 + 512 = 1024 Since TCP is in slow start, a TCP acknowledgement results in
the window growing by one segment

TCP window continues to grow exponentially until it reaches the


ssthresh (=32731) value

Data
size = 3072

TCP Segment Six TCP segments are transmitted in the slow start mode
size = 512

TCP Segment
size = 512

TCP Segment
size = 512
Client Net Server
Client App Client Network Server
Socket Socket

TCP Segment
size = 512

TCP Segment
size = 512

TCP Segment
size = 512

ACK Ack for the first two segments is received


cwnd = 32730 + 512 = 33242 TCP is in slow start so the congestion window is increased by
one segment

Back to congestion avoidance


Congestion Avoidance Now cwnd (=33242") > ssthresh (=32731), thus the TCP
session moves into congestion avoidance
ACK Ack for the next two segments is received
cwnd = 33242 + Now the TCP window is growing very slowly by approximately 8
(512*512)/33242 = 33242 + 8 = bytes per ack
33250

ACK Ack for the last two segments is received


cwnd = 33250 + Congestion window continues to advance at a slow rate
(512*512)/33250 = 33250 + 8 =
33258

Client closes TCP connection

Client to server TCP connection release


Close Client application wishes to release the TCP connection
FIN Client sends a TCP segment with the FIN bit set in the TCP
header
FIN Wait 1 Client changes state to FIN Wait 1 state
ACK Client receives the ACK
FIN Wait 2 Client changes state to FIN Wait 2. In this state, the TCP
connection from the client to server is closed. Client now waits
close of TCP connection from the server end

Server to client TCP connection release


FIN Client receives FIN
ACK Client sends ACK
Close_Timer Client starts a timer to handle scenarios where the last ack has
been lost and server resends FIN
Time Wait Client waits in Time Wait state to handle a FIN retry
Close_Timer Close timer has expired. Thus the client end connection can be
closed too.
Closed
Client Net Server
Client App Client Network
Socket

delete

This sequence diagram was generated with EventStudio System Designer (http://www.EventHelix.com/EventStudio).

You might also like