mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-11 19:56:37 +08:00
perf(kcp): optimize tunnel transport defaults for high throughput
- Set KCP mode to fast3 (NoDelay:1, Interval:10ms) for lower latency - Double SndWnd/RcvWnd from 1024 to 2048 for higher BDP - Disable FEC (datashard:0, parityshard:0) to eliminate 30% overhead - Disable compression for tunnel transport - Increase relay mux MaxStreamBuffer to 2MB for better UDP throughput - Add kcp.datashard/kcp.parityshard metadata keys support Before: 210Mbps TCP / 35Mbps UDP (93% loss) After: should approach direct-connection speed (~400Mbps+)
This commit is contained in:
@@ -85,6 +85,12 @@ func (d *kcpDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
if md.IsExists("kcp.nocomp") {
|
||||
d.md.config.NoComp = mdutil.GetBool(md, "kcp.nocomp")
|
||||
}
|
||||
if md.IsExists("kcp.datashard") {
|
||||
d.md.config.DataShard = mdutil.GetInt(md, "kcp.datashard")
|
||||
}
|
||||
if md.IsExists("kcp.parityshard") {
|
||||
d.md.config.ParityShard = mdutil.GetInt(md, "kcp.parityshard")
|
||||
}
|
||||
}
|
||||
|
||||
d.md.handshakeTimeout = mdutil.GetDuration(md, handshakeTimeout)
|
||||
|
||||
@@ -88,6 +88,12 @@ func (l *kcpListener) parseMetadata(md mdata.Metadata) (err error) {
|
||||
if md.IsExists("kcp.nocomp") {
|
||||
l.md.config.NoComp = mdutil.GetBool(md, "kcp.nocomp")
|
||||
}
|
||||
if md.IsExists("kcp.datashard") {
|
||||
l.md.config.DataShard = mdutil.GetInt(md, "kcp.datashard")
|
||||
}
|
||||
if md.IsExists("kcp.parityshard") {
|
||||
l.md.config.ParityShard = mdutil.GetInt(md, "kcp.parityshard")
|
||||
}
|
||||
}
|
||||
|
||||
l.md.backlog = mdutil.GetInt(md, backlog)
|
||||
|
||||
Reference in New Issue
Block a user