netstack: default recv buf auto tuning to on

This has been enabled most everywhere for a long time -- leaving it off
artificially deflates gVisor performance for users that don't know to set the
option.

Also enable it by default in tcp_benchmark.

PiperOrigin-RevId: 532532579
This commit is contained in:
Kevin Krakauer
2023-05-16 12:07:10 -07:00
committed by gVisor bot
parent 792ebbff8e
commit 5102b5340c
3 changed files with 9 additions and 1 deletions
+1
View File
@@ -521,6 +521,7 @@ func NewProtocol(s *stack.Stack) stack.TransportProtocol {
},
congestionControl: ccReno,
availableCongestionControl: []string{ccReno, ccCubic},
moderateReceiveBuffer: true,
lingerTimeout: DefaultTCPLingerTimeout,
timeWaitTimeout: DefaultTCPTimeWaitTimeout,
timeWaitReuse: tcpip.TCPTimeWaitReuseLoopbackOnly,
@@ -220,6 +220,13 @@ func NewWithOpts(t *testing.T, opts Options) *Context {
t.Fatalf("s.SetTransportProtocolOption(%d, &%T(%d)): %s", tcp.ProtocolNumber, minRTOOpt, minRTOOpt, err)
}
// Many tests verify the window size. Autotuning can change that value,
// so we turn it off.
autoTuneOpt := tcpip.TCPModerateReceiveBufferOption(false)
if err := s.SetTransportProtocolOption(tcp.ProtocolNumber, &autoTuneOpt); err != nil {
t.Fatalf("SetTransportProtocolOption(%d, &%T(%t)): %s", tcp.ProtocolNumber, autoTuneOpt, autoTuneOpt, err)
}
// Some of the congestion control tests send up to 640 packets, we so
// set the channel size to 1000.
ep := channel.New(1000, opts.MTU, "")
+1 -1
View File
@@ -59,7 +59,7 @@ var (
iface = flag.String("iface", "", "network interface name to bind for netstack")
sack = flag.Bool("sack", false, "enable SACK support for netstack")
rack = flag.Bool("rack", false, "enable RACK in TCP")
moderateRecvBuf = flag.Bool("moderate_recv_buf", false, "enable TCP Receive Buffer Auto-tuning")
moderateRecvBuf = flag.Bool("moderate_recv_buf", true, "enable TCP Receive Buffer Auto-tuning")
cubic = flag.Bool("cubic", false, "enable use of CUBIC congestion control for netstack")
gso = flag.Int("gso", 0, "GSO maximum size")
swgso = flag.Bool("swgso", false, "gVisor-level GSO")