Re: Tweaking TCP windowsize
Re: Tweaking TCP windowsize
- Subject: Re: Tweaking TCP windowsize
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Thu, 23 Jun 2011 09:29:26 +0100
On 23 Jun 2011, at 07:38, Andreas Fink wrote:
> The problem is that filetransfers over TCP get slowed down by the window size which defaults to 64k.
My experience is that the advertised TCP window size is controlled by the socket receive buffer size, subject to the limits of TCP window scaling.
<http://en.wikipedia.org/wiki/TCP_window_scale_option>
When I create a connection between two vanilla Macs on my local network, the window size ends up being set to roughly 512 KB.
> [...]
> Transmission Control Protocol, Src Port: 12345 (12345), Dst Port: 54781 (54781), Seq: 1, Ack: 1, Len: 0
> Source port: 12345 (12345)
> Destination port: 54781 (54781)
> [Stream index: 1]
> Sequence number: 1 (relative sequence number)
> Acknowledgement number: 1 (relative ack number)
> Header length: 32 bytes
> Flags: 0x10 (ACK)
> 0... .... = Congestion Window Reduced (CWR): Not set
> .0.. .... = ECN-Echo: Not set
> ..0. .... = Urgent: Not set
> ...1 .... = Acknowledgement: Set
> .... 0... = Push: Not set
> .... .0.. = Reset: Not set
> .... ..0. = Syn: Not set
> .... ...0 = Fin: Not set
> Window size: 524280 (scaled)
> [...]
The mechanics of this are somewhat complex. Specifically, TCP will set the socket buffer size to 64 KB unless it's on a lightly loaded system, at which point it will ramp up the size. To understand this better, search the following file for "tcp_sockthreshold".
<http://www.opensource.apple.com/source/xnu/xnu-1456.1.26/bsd/netinet/tcp_usrreq.c>
Also note that tcp_sockthreshold is tunable via the net.inet.tcp.sockthreshold sysctl.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden