conn,device,tun: use single ~128KiB packet buf for batched i/o - #87
Open
jwhited wants to merge 1 commit into
Open
conn,device,tun: use single ~128KiB packet buf for batched i/o#87jwhited wants to merge 1 commit into
jwhited wants to merge 1 commit into
Conversation
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
marked this pull request as ready for review
August 21, 2026 22:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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