erebe / wstunnel

Tunnel all your traffic over Websocket or HTTP2 - Bypass firewalls/DPI - Static binary available
Other
3.17k stars 287 forks source link

CPU consumption increases #218

Closed bytejedi closed 3 months ago

bytejedi commented 3 months ago

Describe the bug Not a bug, just noticed an increase in CPU consumption.

To Reproduce The CPU consumption of version 8.5.4 has increased compared to version 8.0.0, while there is not much difference in memory consumption. My use case involves WireGuard over WebSocket. wstunnel client running on macOS Intel chip wstunnel server running on Debian12 x86_64

Expected behavior A clear and concise description of what you expected to happen.

Screenshots v8.5.4 ⬇️

image

v8.0.0 ⬇️

image

The running time and load of these two pictures are basically the same. They both run for ten minutes and the download speed is 1MB/S, but they are not that accurate. Comparing the difference between wstunnel and wireguard-go, you can see that there is a certain gap in CPU time. After running for some time, the CPU time of wstunnel 8.0.0 never exceeded that of wireguard-go. However, with version 8.5.4, the CPU time is consistently higher than wireguard-go. The wireguard-go version has not changed.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

erebe commented 3 months ago

Hello,

I suppose you are using client tunnel with -L 'udp://xxxx' as it is wireguard ? Or is this on the server side of wstunnel ? Would you mind trying intermediate releases, and let me know if you find a specific one where you find thie CPU increase ?

I haven't tried to profile too much so far, as I still have improvements/features I want to introduce. I will look at it at some point :) But if you can find a specific release that trigger it, it would be really helpful !

bytejedi commented 3 months ago

Thank you for your response. The screenshots are from client side. I understand you want to pinpoint a specific commit. I will test the intermediate versions when I have time. Thank you for your hard work; it's what makes this project so great.

bytejedi commented 3 months ago

After running version 9.2.1 for an extended period, it seems that the issue no longer exists. Thank you!