Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

局域网上行带宽占满问题 #21

Closed
yaleh opened this issue May 30, 2016 · 11 comments
Closed

局域网上行带宽占满问题 #21

yaleh opened this issue May 30, 2016 · 11 comments

Comments

@yaleh
Copy link

yaleh commented May 30, 2016

近期在办公室应用 kcptun 时碰到以下问题:

  • GPON 非对称接入,下行 100Mbps,上行 5Mbps,x86 网关连接光猫,网关 PPPOE 拨号
  • kcptun + ss-redir 部署在网关
  • 如当前主要是 kcptun 下行,则表现良好:kcp client RX 可超过 5MBps,tcp TX 超过 1MBps,多路 kcp 下行(如 Youtube 1080P)稳定
  • 当有人通过 kcptun 上传(如 Google Drive)时,kcptun client 积极占用带宽,kcptun 至光猫流量超过 1MBps。此时其它 kcp 流量(无论上下行)都基本无法使用,甚至网关的 PPPOE 拨号断开并自动重连

该情况在办公室多人应用环境下非常突出,调节 kcptun 参数也没解决。现在正在考虑在 ss-redir 和 kcptun 之间使用 tc 做 QoS 来控制。

希望 kcptun 可实现简单的 QoS 控制 kcp TX 的总带宽。

@xtaci
Copy link
Owner

xtaci commented May 30, 2016

嗯,建议用tc控制下,我就是这么用的,并且排除google drive, icloud, s3的上行流量,这个问题就是用tc解决最合适,最专业。当然,如果路由器本身能做到对某个VPS的IP做上行限流,最好, kcp本身并不限流

@xtaci
Copy link
Owner

xtaci commented May 30, 2016

#!/bin/bash
tc qdisc del dev p2p1 root

# root
tc qdisc add dev p2p1 root handle 1: htb
# up
tc class add dev p2p1 parent 1: classid 1:1 htb rate 4mbit
tc class add dev p2p1 parent 1:1 classid 1:10 htb rate 2mbit
tc class add dev p2p1 parent 1:1 classid 1:20 htb rate 2mbit
tc qdisc add dev p2p1 parent 1:10 handle 10: sfq perturb 10

# filter
tc filter add dev p2p1 protocol ip parent 1:0 prio 1 handle 10 fw flowid 1:10
tc filter add dev p2p1 protocol ip parent 1:0 prio 1 handle 20 fw flowid 1:20

tc 分类,4M 上行分为两个2M上行,一个国内,一个KCP

mangle 
-A POSTROUTING -o p2p1 -d 108.61.XXX.XXX -j MARK --set-mark 20
-A POSTROUTING -o p2p1 -m iprange --src-range 192.168.1.2-192.168.1.254 -j MARK --set-mark 10

上行分组

@xtaci xtaci changed the title TX QoS 局域网上行带宽占满问题 May 30, 2016
@xtaci
Copy link
Owner

xtaci commented May 30, 2016

@yaleh 另外我今天实现了阻塞的Write()操作,不会无限制的写入大量数据到snd_queue里面,或多或少会有利于带宽的约束。

@yaleh
Copy link
Author

yaleh commented May 30, 2016

Let me try try

@jannson
Copy link
Contributor

jannson commented May 31, 2016

试的结果如何?

在家里用 kcptun,想在公司也切换到这个。

@wxyzh
Copy link

wxyzh commented May 31, 2016

重新编译了一个,从youtube上来看,快了些

@xtaci
Copy link
Owner

xtaci commented May 31, 2016

公司用没什么大问题,主要是要注意

  1. 上行到vps的限速,建议tc或者带网管功能的路由器做
  2. 流量均衡, 某些网盘,如icloud,s3,google drive 会占用掉全部的上行带宽,必须限制,让其直链。

@xtaci
Copy link
Owner

xtaci commented May 31, 2016

@wxyzh 说明dscp还是有用的,不过如果长期申请EF类型的传输,某些厂家的设备会屏蔽。

@xtaci
Copy link
Owner

xtaci commented May 31, 2016

优化了fast模式的载荷比

@xtaci
Copy link
Owner

xtaci commented Jun 2, 2016

@yaleh @jannson 发现一个kcp的fastack的问题,会导致大量的不必要的重传,正在和原作者讨论此问题,并发了一个我个人的fix,0602版本。 带宽消耗至少降低一半。

@xtaci
Copy link
Owner

xtaci commented Jun 2, 2016

SNMP

  1. Reduce memory usage by avoiding make on fec group
  2. Release freebsd binary version
  3. Expose SetNoDelay() function for future manual control
  4. Add SNMP to dump information, kill -SIGUSR1 pid to print
  5. Pipeline ReadFromUDP() for faster receiving of UDP Packets
  6. Fix parse_ack() for too many fast resend
  7. Adjust yamux max window size for better streaming of UHD video

@xtaci xtaci closed this as completed Jun 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants