Skip to content

netstack: performance w/TCP-RACK on Windows #9778

Description

@jwhited

Description

Our usage of netstack within tailscale performs poorly on Windows with the following stack settings:

  • default congestion control (reno)
  • tcpip.TCKSACKEnabled(true)
  • default TCP loss recovery (tcpip.TCPRACKLossDetection)

Using Stack.AddTCProbe() to print congestion window (in packets) shows the window being held below 10 packets during a throughput test:

	var lastDebug time.Time
	ipstack.AddTCPProbe(func(s *stack.TCPEndpointState) {
		now := time.Now()
		if now.After(lastDebug.Add(time.Second)) {
			logf("%s:%d => %s:%d cwnd in packets: %d", s.ID.LocalAddress.String(), s.ID.LocalPort, s.ID.RemoteAddress.String(), s.ID.RemotePort, s.Sender.SndCwnd)
			lastDebug = now
		}
	})
2023/11/29 18:58:24 100.78.224.154:80 => 100.90.1.8:64349 cwnd in packets: 7
2023/11/29 18:58:24 100.78.224.154:80 => 100.90.1.8:64348 cwnd in packets: 9
2023/11/29 18:58:24 100.78.224.154:80 => 100.90.1.8:64347 cwnd in packets: 5
2023/11/29 18:58:25 100.78.224.154:80 => 100.90.1.8:64349 cwnd in packets: 5
2023/11/29 18:58:26 100.78.224.154:80 => 100.90.1.8:64351 cwnd in packets: 8
2023/11/29 18:58:26 100.78.224.154:80 => 100.90.1.8:64349 cwnd in packets: 7
2023/11/29 18:58:27 100.78.224.154:80 => 100.90.1.8:64350 cwnd in packets: 9

Throughput is poor (8Mb/s). Changing TCP loss recovery to 0 (no TCP-RACK) results in significantly improved throughput by a factor of ~10 (8Mb/s => 80Mb/s). Congestion window moves in a more expected fashion. Path under test is not particularly lossy.

Linux does not exhibit the same behavior/issue. This appears to be Windows-specific. Reproduced by multiple users in multiple environments across Windows 11 and Windows Server 2022.

Originally reported via tailscale/tailscale#9707

Steps to reproduce

tailscale/tailscale#9707 (comment) describes steps to reproduce using tailscale. We have since changed loss recovery on Windows as a workaround via tailscale/tailscale@5e861c3.

Reproduced at both gVisor HEAD (4b4191b) and what tailscale is currently using (4fe3006)

runsc version

No response

docker version (if using docker)

No response

uname

No response

kubectl (if using Kubernetes)

No response

repo state (if built from source)

No response

runsc debug logs (if available)

No response

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions