outline-go-tun2socks
outline-go-tun2socks copied to clipboard
Increase MTU size to 16KiB
The MTU for the LWIP stack is currently set at 1500: https://github.com/eycorsican/go-tun2socks/blob/ca0c721c0d65844e43f8b0f090d72d5e9f313515/core/lwip.go#L169
That means each packet from the OS will be at most 1500. Combined with the fact that each read from the go-tun2socks stack only gets us one packet (https://github.com/eycorsican/go-tun2socks/issues/149), that means we do very short writes to the network. This adds overhead to uploads, does more CPU iterations and wastes the larger 16KiB write buffers we allocate.
We should increase the LWIP MTU to 16KiB, since that's the maximum Shadowsocks payload size (https://shadowsocks.org/en/wiki/AEAD-Ciphers.html).
/cc @bemasc @alalamav
I wonder if this has any relation to the excessive wakeups we see on iOS sometimes.