database64128 / swgp-go

🐉 Simple WireGuard proxy with minimal overhead for WireGuard traffic.
GNU Affero General Public License v3.0
224 stars 23 forks source link

Bandwidth reduce #30

Closed paxaq closed 1 year ago

paxaq commented 1 year ago

When using swgp-go on each side. The Bandwidth was reduced 30%. The test method is iperf3. MTU on server is 1420 and on client is 1384. Is this normal? Thanks

database64128 commented 1 year ago

Copying UDP packets back and forth between kernel and userspace can be expensive. It helps a bit if both sides are on Linux, since the more efficient recvmmsg(2) and sendmmsg(2) syscalls can be used.

I would also recommend using the same MTU value on both client and server, to avoid issues with padding and IP fragmentation.

database64128 commented 1 year ago

If you really need higher throughput for tunneled TCP connections, take a look at https://github.com/database64128/shadowsocks-go. Proxying TCP streams using the Shadowsocks 2022 protocol is even faster than over raw WireGuard. Feel free to do some tests with iperf3 and share the results.

paxaq commented 1 year ago

Test two The client was changed to ARM64 Linux. The same MTU 1420 was used on both sides. Without swgp-go got 35.2Mbps. Using swgp-go got 31.6Mbps. As you said. Pretty good. Thank you

database64128 commented 1 year ago

A new release is out with more improvements. If you don't have more questions, please close this issue.