Subject: Re: TCP socket buffers automatic sizing
To: None <>
From: Mindaugas R. <>
List: tech-net
Date: 07/21/2007 17:20:58
Greg Troxel <> wrote:
> Is there an RFC about this, or an implementation elsewhere?

As I wrote in the primary email - this is a port from FreeBSD. One could take
a look at extensions written in RFC1323, but I do not know a concrete RFC
about this.

> FreeBSD had a patch in the fall - I don't know if it's in now:

They have it in -current about 5 months, enabled by default.

> Have you looked at connections with tcpdump2xplot and xplot (both in
> pkgsrc/graphics/xplot)?  It's very illuminating about TCP behavior.

No, that is why I would be happy if someone would do some analysis of TCP
behaviour :)

>   @@ -4015,8 +4088,7 @@ syn_cache_add(struct sockaddr *src, stru
>                   sc->sc_requested_s_scale = tb.requested_s_scale;
>                   sc->sc_request_r_scale = 0;
>                   while (sc->sc_request_r_scale < TCP_MAX_WINSHIFT &&
>   -                   TCP_MAXWIN << sc->sc_request_r_scale <
>   -                   so->so_rcv.sb_hiwat)
>   +                   (0x1 << sc->sc_request_r_scale) < tcp_minmss)
>                           sc->sc_request_r_scale++;
>           } else {
>                   sc->sc_requested_s_scale = 15;
> I didn't understand this hunk.

The patch is updated. Please take a look at this place, there is a comment
from FreeBSD.

> <...> But, we have to advertise a large window to get the sender to open
> up, even if our application reads the data promptly.
> <...>
> How does the receive window get set?  Should it be the max that autosize
> will go to?  If it's not large, how does this help?

I am not sure what do you mean. The window scaling is done by stepping, as
written in the description of criteria, and algorithm.

> Shouldn't SB_AUTOSIZE only be enabled on sockets if the sysctl is on?
I do not see the necessity, right now.

> Shouldn't there be a socket option?  Does expliciting setting a buffer
> size clear SB_AUTOSIZE?
Currently, autosizing is a global setting, not per-socket. If we would make
it per-socket - both your points are reasonable.

> Probably this should default to off at first (sysctl intial setting)
> until more people have run it, which will happen once it's in current -
> sysctl -w is easier than patch/rebuild.  I'd turn it on, but haven't
> done a reboot cycle to try it.

Yes, I just have not mentioned that I would commit this with default off.

Best regards,