Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've read that 2.6.33+ allows setting custom cwnd.

  1. if the IW is 10 by default (for all distros? only some?)
  2. how does one view what the current IW is on a particular compiled kernel?

references:

share|improve this question

2 Answers

up vote 6 down vote accepted

As of Linux kernel version 2.6.38 (released March 2011) the receive window was increased to 10 segments to make sure that a low value will not become a bottleneck for any senders that implement IW10. The initial congestion window, respectively, was afterwards increased to 10 segments in kernel version 2.6.39 (released May 2011). As a side note kernel version 3.0 was released in the end of July 2011.

You can see the source code at http://lxr.linux.no/#linux+v2.6.38/include/net/tcp.h#L64 and http://lxr.linux.no/#linux+v2.6.39/include/net/tcp.h#L199.

Latest desktop distributions (released Q4/2011) such as Ubuntu/Kubuntu/... and Fedora use kernel versions 3.x with 3.1.5 being the latest at the moment.

Stable server distributions adopt much slower newer kernels and software in general. For example, Debian stable 6.0.3 released in October 2011 goes with kernel version 2.6.32-38 while Red Hat Enterprise Linux 6.x and CentOS 6.x use kernel versions 2.6.32 to 2.6.34.

Edit: The article that says the first version with IW10 support is 2.6.33 is wrong. I went through the source code of many kernel versions some time before writing this answer. Versions 2.6.38 and 2.6.39 were the first ones I found to respectively increase the receive and congestion windows. Moreover, the change logs confirm it - see http://kernelnewbies.org/Linux_2_6_38 and http://kernelnewbies.org/Linux_2_6_39.

share|improve this answer
1  
Great, very helpful. However there's conflicting information about the version -- this article igvita.com/2011/10/20/faster-web-vs-tcp-slow-start says "As of kernel version 2.6.33, following a protracted discussion and a number of IETF recommendations, the initial cwnd value has been reset to 10 packets" – John Dec 14 '11 at 22:08
The article at igvita.com highly probably has an error where it claims 2.6.33 supports IW10. – Mikko Rantalainen Jun 21 '12 at 8:03

You should look closer at code demonstrated in your first link:

net/ipv4/tcp_output.c

/* Set initial window to value enough for senders,
 * following RFC2414. Senders, not following this RFC,
 * will be satisfied with 2.
 */
if (mss > (1 << *rcv_wscale)) {
    int init_cwnd = 4;
    if (mss > 1460 * 3)
      init_cwnd = 2;
    else if (mss > 1460)
      init_cwnd = 3;
    if (*rcv_wnd > init_cwnd * mss)
      *rcv_wnd = init_cwnd * mss;
}

In newer kernels (since 21 Dec 2010) constant defined in

include/net/tcp.h

/* Offer an initial receive window of 10 mss. */
#define TCP_DEFAULT_INIT_RCVWND 10

So to put it simple: support initial window == 10 depends on kernel version and patches applied by your distribution, wscale and mss. You should really try to look at your kernel's sources and system setup(MTU).

For Linux <= 2.6.38 init_cwnd is not tunable there and set between 2 and 4. The only way to tune it is to hack tcp_output and recompile a kernel. As i see in Linux HEAD (3.2 by now) it's defaults to TCP_DEFAULT_INIT_RCVWND which is 10 by default.

PS. You can tune this variable per route via ip route:

   initcwnd NUMBER (2.5.70+ only)
          the  initial congestion window size for connections to this des‐
          tination.  Actual window size is this value  multiplied  by  the
          MSS  (``Maximal Segment Size'') for same connection. The default
          is zero, meaning to use the values specified in RFC2414.

   initrwnd NUMBER (2.6.33+ only)
          the initial receive window size for connections to this destina‐
          tion.  Actual window size is this value multiplied by the MSS of
          the connection.  The default value is zero, meaning to use  Slow
          Start value.

PS. IW10 is only one of Google proposed enchantments to TCP

share|improve this answer
Thanks -- but the problem is I'm not enough of a C or Kernel hacker to fully understand the space, so I still don't know what the answer is. Could you perhaps articulate the answer instead of merely showing me code which implies it? – John Nov 17 '11 at 23:22
Interesting -- could you put that info above into your answer, and maybe offer some guidance about how to figure out what settings a popular distributed kernel has? – John Nov 18 '11 at 0:09
here are a list of terms/variables you've mentioned that I do not understand: mss, rcv_wscale, init_cwnd, rcv_wnd, wscale, MTU. :-D – John Nov 18 '11 at 0:11
i've also made my original 2 questions a bit more clear. – John Nov 18 '11 at 0:12
2  
If you can't understand code/terms then you should not really touch that code. TCP is pretty complex - there are lots of RFCs involved. – SaveTheRbtz Nov 21 '11 at 7:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.