• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 620
  • Last Modified:

Tcp, congestion control and slow start

I have 2 linux machines connected over the serial port using an external wireless modem. I'm using ppp. I was trying to inject noise in to the channel and observe how tcp performs. My understanding of congestion control algorithms is that if there is packet loss tcp reduces its window size to avoid congestion. I'm using tcpdump to study packet loss and tcp headers. I can see that packets are getting lost and tcp is retransmitting. But the window sizes are not changing. Initially when I'm setting up the link the window size starts at 512 and then from the next transmission on is 32000.      

So I'm not seeing either slow start or congestion control algorithms. Am i missing something. Please help me if anyone knows whats going on.

  • 2
1 Solution
I pulled this from a draft IETF paper..


  To view the entire list of current Internet-Drafts, please check the
    "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow
    Directories on ftp.is.co.za (Africa), ftp.nordu.net (Northern
    Europe), ftp.nis.garr.it (Southern Europe), munnari.oz.au (Pacific
    Rim), ftp.ietf.org (US East Coast), or ftp.isi.edu (US West Coast).

3.1 Slow Start and Congestion Avoidance

    The slow start and congestion avoidance algorithms MUST be used by a
    TCP sender to control the amount of outstanding data being injected
    into the network.  To implement these algorithms, two variables are
    added to the TCP per-connection state.  The congestion window (cwnd)
    is a sender-side limit on the amount of data the sender can transmit
    into the network before receiving an acknowledgment (ACK), while the
    receiver's advertised window (rwnd) is a receiver-side limit on the
    amount of outstanding data.  The minimum of cwnd and rwnd governs
    data transmission.

    Another state variable, the slow start threshold (ssthresh), is used
    to determine whether the slow start or congestion avoidance
    algorithm is used to control data transmission, as discussed below.

    Beginning transmission into a network with unknown conditions
    requires TCP to slowly probe the network to determine the available
    capacity, in order to avoid congesting the network with an
    inappropriately large burst of data.  The slow start algorithm is
    used for this purpose at the beginning of a transfer, or after
    repairing loss detected by the retransmission timer.

    IW, the initial value of cwnd, MUST be less than or equal to MSS

    We note that a non-standard, experimental TCP extension allows that
    a TCP MAY use a larger initial window (IW), as defined in equation 1

               IW = min (4*MSS, max (2*MSS, 4380 bytes))             (1)

    With this extension, a TCP sender MAY use a 2 segment initial
    window, regardless of the segment size, and 3 and 4 segment initial
    windows MAY be used, provided the combined size of the segments does
    not exceed 4380 bytes.  We do NOT allow this change as part of the
    standard defined by this document.  However, we include discussion
    of (1) in the remainder of this document as a guideline for those
    experimenting with the change, rather than conforming to the present
    standards for TCP congestion control.

    The initial value of ssthresh MAY be arbitrarily high (for example,
    some implementations use the size of the advertised window), but it
    may be reduced in response to congestion.  The slow start algorithm
    is used when cwnd < ssthresh, while the congestion avoidance
    algorithm is used when cwnd > ssthresh.  When cwnd and ssthresh are
    equal the sender may use either slow start or congestion avoidance.

    During slow start, a TCP increments cwnd by at most MSS bytes for
    each ACK received that acknowledges new data.  Slow start ends when
    cwnd exceeds ssthresh (or, optionally, when it reaches it, as noted
    above); or when cwnd reaches rwnd; or when congestion is observed.

    During congestion avoidance, cwnd is incremented by 1 full-sized
    segment per round-trip time (RTT).  Congestion avoidance continues
    until cwnd reaches the receiver's advertised window or congestion is
    detected.  One formula commonly used to update cwnd during
    congestion avoidance is given in equation 2:

                          cwnd += MSS*MSS/cwnd                       (2)

    This adjustment is executed on every incoming non-duplicate ACK.
    Equation (2) provides an acceptable approximation to the underlying
    principle of increasing cwnd by 1 full-sized segment per RTT.  (Note
    that for a connection in which the receiver acknowledges every data
    segment, (2) proves slightly more aggressive than 1 segment per RTT,
    and for a receiver acknowledging every-other packet, (2) is less

    Implementation Note: Since integer arithmetic is usually used in TCP
    implementations, the formula given in equation 2 can fail to
    increase cwnd when the congestion window is very large (larger than
    MSS*MSS).  If the above formula yields 0, the result SHOULD be
    rounded up to 1 byte.

    Implementation Note: older implementations have an additional
    additive constant on the right-hand side of (2).  This is incorrect
    and can actually lead to diminished performance [PAD+98].

    Another acceptable way to increase cwnd during congestion avoidance
    is to count the number of bytes that have been acknowledged by ACKs
    for new data.  (A drawback of this implementation is that it
    requires maintaining an additional state variable.)  When the number
    of bytes acknowledged reaches cwnd, then cwnd can be incremented by
    up to MSS bytes.  Note that during congestion avoidance, cwnd MUST
    NOT be increased by more than the larger of either 1 full-sized
    segment per RTT, or the value computed using equation 2.

    Implementation Note: some implementations maintain cwnd in units of
    bytes, while others in units of full-sized segments.  The latter
    will find equation (2) difficult to use, and may prefer to use the
    counting approach discussed in the previous paragraph.

    When a TCP sender detects segment loss using the retransmission
    timer, the value of ssthresh MUST be set to no more than the value
    given in equation 3:

                   ssthresh = max (FlightSize / 2, 2*MSS)             (3)
    As discussed above, FlightSize is the amount of outstanding data in
    the network.

    Implementation Note: an easy mistake to make is to simply use cwnd,
    rather than FlightSize, which in some implementations may
    incidentally increase well beyond rwnd.

    Furthermore, upon a timeout cwnd MUST be set to no more than the
    loss window, LW, which equals 1 full-sized segment (regardless of
    the value of IW).  Therefore, after retransmitting the dropped
    segment the TCP sender uses the slow start algorithm to increase the
    window from 1 full-sized segment to the new value of ssthresh, at
    which point congestion avoidance again takes over in a fashion
    identical to that for a connection's initial slow start.

peddibhotlaAuthor Commented:

Thanks for replying. I have one more question though. Is there any way you could observe the Congestion window changes, other than by the reduction in the throughput?

Thank you,
there are a host of papers on the subject at url


Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now