xtaci / kcptun

A Quantum-Safe Secure Tunnel based on QPP, KCP, FEC, and N:M multiplexing.
MIT License
13.94k stars 2.54k forks source link

Kcptun is super slow compared to typical TCP #868

Open aminPial opened 2 years ago

aminPial commented 2 years ago

Not sure why this is happening! I am getting 625 kB/s at kcptun and getting 1.8 MB/s at TCP. And a typical reliable UDP (I implemented it) is getting 2.4 MB/s here.

what config did you try?

in client:

client_windows_386.exe -r "my_server_ip:4000" -l ":8388" -key "123" -nocomp -autoexpire 900 -sockbuf 16777217 -dscp 46

in server

./server_linux_amd64 -t "127.0.0.1:8388" -l ":4000" -mode fast3 -nocomp -sockbuf 16777217 -dscp 46 -key "123"

I am using regular python TCP sockets. Not sure why this is happening. My expectation was to get above 2.5 MB/s at kcptun. Can anyone help?

yzslab commented 2 years ago

You need to tune window size (at least one BDP) to get maximum throughput. BDP = RTT * bandwidth, kcp window size = BDP / MTU

--sndwnd value                   set send window size(num of packets) (default: 128)
--rcvwnd value                   set receive window size(num of packets) (default: 512)
aminPial commented 2 years ago

You need to tune window size (at least one BDP) to get maximum throughput. BDP = RTT * bandwidth, kcp window size = BDP / MTU

--sndwnd value                   set send window size(num of packets) (default: 128)
--rcvwnd value                   set receive window size(num of packets) (default: 512)

will try for sure.