Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Increase MTU size to 16KiB #67

Open
fortuna opened this issue Nov 25, 2020 · 1 comment
Open

Increase MTU size to 16KiB #67

fortuna opened this issue Nov 25, 2020 · 1 comment

Comments

@fortuna
Copy link
Contributor

fortuna commented Nov 25, 2020

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 (eycorsican/go-tun2socks#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

@fortuna
Copy link
Contributor Author

fortuna commented Nov 25, 2020

I wonder if this has any relation to the excessive wakeups we see on iOS sometimes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant