Re: Automatic TCP send socker buffer sizing

From: Chris <chrcoluk_at_gmail.com>
Date: Wed, 22 Nov 2006 06:36:57 +0000
On 16/11/06, Andre Oppermann <andre_at_freebsd.org> wrote:
> This is a patch adding automatic TCP send socket buffer sizing.  Normally
> the socket buffers are static (either derived from global defaults or set
> with setsockopt) and do not adapt to real network conditions.  Two things
> happen: a) your socket buffers are too small and you can't reach the full
> potential of the network between both hosts; b) your socket buffers are
> too big and you waste a lot of kernel memory for data just sitting around.
>
> With automatic TCP send socket buffers we can start with a small buffer
> and quickly grow it in parallel with the TCP congestion window to match
> real network conditions.
>
> FreeBSD has a default 32K send socket buffer.  This supports a maximal
> transfer rate of only slightly more than 2Mbit/s on a 100ms RTT trans-
> continental link.  Or at 200ms just above 1Mbit/s.  With TCP send buffer
> auto scaling and the default values below it supports 20Mbit/s at 100ms
> and 10Mbit/s at 200ms.  That's an improvement of factor 10, or 1000%.
>
> New sysctl's are:
>
>  net.inet.tcp.sndbuf_auto=1    (enabled)
>  net.inet.tcp.sndbuf_inc=8192  (8K, step size)
>  net.inet.tcp.sndbuf_max=262144        (256K, growth limit)
>
> The patch is available here:
>
>  http://people.freebsd.org/~andre/tcp_auto_sndbuf-20061116.diff
>
> Any testers, especially with busy FTP servers, are very welcome.
>
> --
> Andre
>
> _______________________________________________
> freebsd-net_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe_at_freebsd.org"
>

Ok I done some intitial tesing and so far looks sweet.

I set default send window to 32120 and started a fxp transfer to
another which on 64240 was limited to around 40mbit so 32120 would
normally give about 20mbit, and I previously had 128280 for 80mbit,
now with a default of 32120 and your default sndbuf settings it zoomed
along at around 80mbit.

this from debug.log shows it working.

Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 82456, new
90648, sb_cc 80272, snd_wnd 66984, sendwnd 66608
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 90648, new
98840, sb_cc 89664, snd_wnd 72776, sendwnd 69504
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 98840, new
107032, sb_cc 97608, snd_wnd 81464, sendwnd 73848
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 107032,
new 115224, sb_cc 107000, snd_wnd 87256, sendwnd 76744
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 115224,
new 123416, sb_cc 112296, snd_wnd 93048, sendwnd 79640
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 123416,
new 131608, sb_cc 121688, snd_wnd 98840, sendwnd 82536
Nov 22 06:33:33 heaven kernel: tcp_output: inc sockbuf, old 131608,
new 139800, sb_cc 129632, snd_wnd 107528, sendwnd 86880
Nov 22 06:33:34 heaven kernel: tcp_output: inc sockbuf, old 139800,
new 147992, sb_cc 137992, snd_wnd 112944, sendwnd 110048
Nov 22 06:33:34 heaven kernel: tcp_output: inc sockbuf, old 147992,
new 156184, sb_cc 147384, snd_wnd 118736, sendwnd 112944
Nov 22 06:33:34 heaven kernel: tcp_output: inc sockbuf, old 156184,
new 164376, sb_cc 155328, snd_wnd 127424, sendwnd 114261

cant wait for the recv side of this patch.

Chris
Received on Wed Nov 22 2006 - 05:36:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:03 UTC