wireguard-go/device
Jordan Whited 4201e08f1d device: distribute crypto work as slice of elements
After reducing UDP stack traversal overhead via GSO and GRO,
runtime.chanrecv() began to account for a high percentage (20% in one
environment) of perf samples during a throughput benchmark. The
individual packet channel ops with the crypto goroutines was the primary
contributor to this overhead.

Updating these channels to pass vectors, which the device package
already handles at its ends, reduced this overhead substantially, and
improved throughput.

The iperf3 results below demonstrate the effect of this commit between
two Linux computers with i5-12400 CPUs. There is roughly ~13us of round
trip latency between them.

The first result is with UDP GSO and GRO, and with single element
channels.

Starting Test: protocol: TCP, 1 streams, 131072 byte blocks
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-10.00  sec  12.3 GBytes  10.6 Gbits/sec  232   3.15 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  12.3 GBytes  10.6 Gbits/sec  232   sender
[  5]   0.00-10.04  sec  12.3 GBytes  10.6 Gbits/sec        receiver

The second result is with channels updated to pass a slice of
elements.

Starting Test: protocol: TCP, 1 streams, 131072 byte blocks
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-10.00  sec  13.2 GBytes  11.3 Gbits/sec  182   3.15 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
Test Complete. Summary Results:
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  13.2 GBytes  11.3 Gbits/sec  182   sender
[  5]   0.00-10.04  sec  13.2 GBytes  11.3 Gbits/sec        receiver

Reviewed-by: Adrian Dewhurst <adrian@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-10-10 15:07:36 +02:00
..
allowedips_rand_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
allowedips_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
allowedips.go global: bump copyright year 2023-02-07 20:39:29 -03:00
bind_test.go global: buff -> buf 2023-03-13 17:55:53 +01:00
channels.go device: distribute crypto work as slice of elements 2023-10-10 15:07:36 +02:00
constants.go global: bump copyright year 2023-02-07 20:39:29 -03:00
cookie_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
cookie.go global: bump copyright year 2023-02-07 20:39:29 -03:00
device_test.go global: buff -> buf 2023-03-13 17:55:53 +01:00
device.go device: wait for and lock ipc operations during close 2023-06-27 17:43:35 +02:00
devicestate_string.go device: remove deviceStateNew 2021-02-09 15:39:19 +01:00
endpoint_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
indextable.go global: bump copyright year 2023-02-07 20:39:29 -03:00
ip.go global: bump copyright year 2023-02-07 20:39:29 -03:00
kdf_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
keypair.go global: bump copyright year 2023-02-07 20:39:29 -03:00
logger.go global: bump copyright year 2023-02-07 20:39:29 -03:00
mobilequirks.go global: bump copyright year 2023-02-07 20:39:29 -03:00
noise_test.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-helpers.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-protocol.go device: uniformly check ECDH output for zeros 2023-02-16 16:33:14 +01:00
noise-types.go global: bump copyright year 2023-02-07 20:39:29 -03:00
peer.go conn, device, tun: implement vectorized I/O plumbing 2023-03-10 14:52:13 +01:00
pools_test.go conn, device, tun: implement vectorized I/O plumbing 2023-03-10 14:52:13 +01:00
pools.go conn, device, tun: implement vectorized I/O plumbing 2023-03-10 14:52:13 +01:00
queueconstants_android.go conn: inch BatchSize toward being non-dynamic 2023-03-10 14:52:22 +01:00
queueconstants_default.go conn: inch BatchSize toward being non-dynamic 2023-03-10 14:52:22 +01:00
queueconstants_ios.go global: bump copyright year 2023-02-07 20:39:29 -03:00
queueconstants_windows.go global: bump copyright year 2023-02-07 20:39:29 -03:00
race_disabled_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
race_enabled_test.go global: bump copyright year 2023-02-07 20:39:29 -03:00
receive.go device: distribute crypto work as slice of elements 2023-10-10 15:07:36 +02:00
send.go device: distribute crypto work as slice of elements 2023-10-10 15:07:36 +02:00
sticky_default.go global: remove old-style build tags 2021-10-12 12:02:10 -06:00
sticky_linux.go conn: disable sticky sockets on Android 2023-03-23 18:39:00 +01:00
timers.go global: bump copyright year 2023-02-07 20:39:29 -03:00
tun.go global: bump copyright year 2023-02-07 20:39:29 -03:00
uapi.go global: bump copyright year 2023-02-07 20:39:29 -03:00