Skip to content

conn,device,tun: use single ~128KiB packet buf for batched i/o - #87

Open
jwhited wants to merge 1 commit into
tailscalefrom
jwhited/slab-bidi
Open

conn,device,tun: use single ~128KiB packet buf for batched i/o#87
jwhited wants to merge 1 commit into
tailscalefrom
jwhited/slab-bidi

Conversation

@jwhited

@jwhited jwhited commented Aug 21, 2026

Copy link
Copy Markdown
Member

Use a single backing array instead of independent backing arrays. This greatly reduces peak RSS under load. Throughput improves for TCP and slightly degrades for UDP.

The following throughput and peak RSS benchmarks were performed with iperf3 between two Intel i5-12400 nodes running Ubuntu 24.04 (Linux 6.8).

UDP benchmarks did not use UDP GSO on sender, so they were roughly equivalent to single packet ops through wireguard-go.

TCP/1 signifies 1 TCP stream; TCP/128 signifies 128 parallel TCP streams.

Throughput (Mb/s)
Test Before After Change
TCP/1 13,709 14,888 +8.6%
TCP/128 11,120 13,471 +21.1%
UDP/1 2,620 2,405 -8.2%
UDP/128 2,209 2,014 -8.8%

Peak memory (VmHWM, kB)
Test Side Before After Reduction
TCP/1 TX 182,404 35,800 80.4%
RX 249,096 38,452 84.6%
TCP/128 TX 330,648 229,180 30.7%
RX 2,986,996 292,988 90.2%
UDP/1 TX 17,540 16,504 5.9%
RX 64,604 14,364 77.8%
UDP/128 TX 16,660 15,828 5.0%
RX 57,104 18,884 66.9%

Updates tailscale/corp#46716
Updates tailscale/corp#22467
Updates tailscale/corp#36989
Updates tailscale/corp#37878

Use a single backing array instead of independent backing arrays. This
greatly reduces peak RSS under load. Throughput improves for TCP and
slightly degrades for UDP.

The following throughput and peak RSS benchmarks were performed with
iperf3 between two Intel i5-12400 nodes running Ubuntu 24.04 (Linux 6.8).

UDP benchmarks did not use UDP GSO on sender, so they were roughly
equivalent to single packet ops through wireguard-go.

TCP/1 signifies 1 TCP stream; TCP/128 signifies 128 parallel TCP
streams.

Throughput (Mb/s)
Test     Before   After   Change
TCP/1    13,709  14,888    +8.6%
TCP/128  11,120  13,471   +21.1%
UDP/1     2,620   2,405    -8.2%
UDP/128   2,209   2,014    -8.8%

Peak memory (VmHWM, kB)
Test     Side     Before    After  Reduction
TCP/1    TX      182,404   35,800      80.4%
         RX      249,096   38,452      84.6%
TCP/128  TX      330,648  229,180      30.7%
         RX    2,986,996  292,988      90.2%
UDP/1    TX       17,540   16,504       5.9%
         RX       64,604   14,364      77.8%
UDP/128  TX       16,660   15,828       5.0%
         RX       57,104   18,884      66.9%

Updates tailscale/corp#46716
Updates tailscale/corp#22467
Updates tailscale/corp#36989
Updates tailscale/corp#37878

Signed-off-by: Jordan Whited <jordan@tailscale.com>
@jwhited
jwhited marked this pull request as ready for review August 21, 2026 22:27
@jwhited
jwhited requested review from a team, cmol and creachadair August 21, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant