[PLUG] TCP window, how to adjust?

Jason R. Martin nsxfreddy at gmail.com
Sat Nov 5 07:02:43 UTC 2005


On 11/4/05, Steven Raymond <stever at woo-hoo.com> wrote:
> How can I see what my size Linux TCP receive window is, when running a CLI
> ftp client to a get a file from a server?

Well you could run tcpdump, for example:

jrmartin at matchbox:~$ sudo tcpdump port ftp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
16:57:14.007608 IP matchbox.martins.36874 > zeus-pub1.kernel.org.ftp:
S 66568643:66568643(0) win 5840 <mss 1460,sackOK,timestamp 8118980
0,nop,wscale 2>
16:57:14.042245 IP zeus-pub1.kernel.org.ftp > matchbox.martins.36874:
S 761033470:761033470(0) ack 66568644 win 5792 <mss
1460,sackOK,timestamp 3329092979 8118980,nop,wscale 2>

Notice the "win 5840" and "win 5792", the advertised windows for my
system and kernel.org respectively.

But I doubt that those are what you care about, since they are dynamic
and change depending on how many outstanding packets haven't been
processed.  You probably want the send and receive buffer sizes,
SO_SNDBUF and SO_RCVBUF, set by the application.  I don't see a way to
set them for my ftp client, but you can change the system-wide
defaults in /proc/sys/net/ipv4/tcp_wmem and
/proc/sys/net/ipv4/tcp_rmem.

> Am troubleshooting some throughput questions and want to adjust my TCP
> window, or at least see what my Linux machine is using &/or negotiating on
> a per-download basis.  Hopefully I can adjust the window manually for
> testing.  Note these are all client sessions, not worried about using the
> machine as a server.
>
> More specifically am trying to find a formula or algorithm that will
> predict download throughput with a given bandwidth, TCP window, and
> measurable latency.

The bandwidth-delay product is what you're looking for.  Basically if
your window is smaller than the bandwidth * delay then you will not
keep the pipe full.  This might help you:

http://www.speedguide.net/bdp.php

Jason



More information about the PLUG mailing list