From dbfadf16c3b2caafb230f774765c2ed53b53c696 Mon Sep 17 00:00:00 2001 From: Moroka8 Date: Thu, 23 Apr 2026 17:46:39 +0700 Subject: [PATCH] perf: tune KCP parameters for higher throughput Reduce update interval to 10ms for lower latency Increase window size to 4096 to improve bandwidth utilization Bump MTU to 1280 --- tcputil/tcputil.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcputil/tcputil.go b/tcputil/tcputil.go index 4e37ea3..896d31b 100644 --- a/tcputil/tcputil.go +++ b/tcputil/tcputil.go @@ -84,9 +84,9 @@ func NewKCPOverDTLS(dtlsConn net.Conn, isServer bool) (*kcp.UDPSession, error) { // Tune KCP for TURN tunnel: // - NoDelay mode for lower latency // - Window sizes suitable for ~5Mbit/s - sess.SetNoDelay(1, 20, 2, 1) // nodelay, interval(ms), resend, nc - sess.SetWindowSize(256, 256) - sess.SetMtu(1200) // conservative MTU to fit inside DTLS+TURN + sess.SetNoDelay(1, 10, 2, 1) // nodelay, interval(ms), resend, nc + sess.SetWindowSize(4096, 4096) + sess.SetMtu(1280) // conservative MTU to fit inside DTLS+TURN sess.SetACKNoDelay(true) return sess, nil