v2fly / discussion

5 stars 0 forks source link

使用Cake 队列优化延迟 #91

Closed Ardentwheel closed 3 years ago

Ardentwheel commented 3 years ago

使用 Cake 队列可以优化延迟,但是对于代理,是没有用上它优先级队列功能的, 既然现在开始结构优化了,也许充分利用已有的工具也是个方向 大家一起测试一下看看有没有更好,希望有人测试一下bbr2+cake

优先级队列有分默认的3级和4级 适配后延迟会更好,集成到路由里甚至可以进行简单的流控

diffserv3 (default)

Provides a simple, general-purpose Diffserv implementation with three tins: Bulk (CS1), 6.25% threshold, generally low priority. Best Effort (general), 100% threshold. Voice (CS7, CS6, EF, VA, TOS4), 25% threshold, reduced Codel interval.

diffserv4

Provides a general-purpose Diffserv implementation with four tins: Bulk (CS1), 6.25% threshold, generally low priority. Best Effort (general), 100% threshold. Video (AF4x, AF3x, CS3, AF2x, CS2, TOS4, TOS1), 50% threshold. Voice (CS7, CS6, EF, VA, CS5, CS4), 25% threshold.

Ubuntu 20.04 / netplan

/etc/networkd-dispatcher/routable.d/50-ifup-hooks

#!/bin/bash
# must be /bin/bash, for some reasons /bin/sh does not work

if [ "$IFACE" == "eth0" ];
then
    tc qdisc replace dev eth0 root cake ethernet
fi

查看状态 tc -s qdisc show dev eth0

Status

Ubuntu 20.04 Xanmod Linux 5.9 (STABLE) 2020-11-19 Vless sysctl

net.core.default_qdisc=cake
net.ipv4.tcp_congestion_control=bbr

# net.ipv4.tcp_tw_recycle=0
#net.ipv4.tcp_tw_reuse=1
#net.ipv4.ip_local_port_range = 1024 65535
#net.ipv4.tcp_rmem = 16384 262144 8388608
#net.ipv4.tcp_wmem = 32768 524288 16777216
#net.core.somaxconn = 8192
#net.core.rmem_max = 16777216
#net.core.wmem_max = 16777216
#net.core.wmem_default = 2097152
#net.ipv4.tcp_max_tw_buckets = 5000
#net.ipv4.tcp_max_syn_backlog = 10240
#net.core.netdev_max_backlog = 10240
#net.netfilter.nf_conntrack_max = 1000000
#net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 7200
#net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_notsent_lowat = 16384
tc -s qdisc show dev eth0
 qdisc cake 8001: root refcnt 2 bandwidth 80Mbit diffserv3 triple-isolate nonat nowash no-ack-filter split-gso rtt 200.0ms noatm overhead 38 mpu 84 
 Sent 840181829 bytes 611096 pkt (dropped 1, overlimits 296021 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 80462b of 8000000b
 capacity estimate: 80Mbit
 min/max network layer size:           32 /    1500
 min/max overhead-adjusted size:       84 /    1538
 average network hdr offset:           14

                   Bulk  Best Effort        Voice
  thresh          5Mbit       80Mbit       20Mbit
  target         10.0ms       10.0ms       10.0ms
  interval      200.0ms      200.0ms      200.0ms
  pk_delay          0us         71us         79us
  av_delay          0us          9us          8us
  sp_delay          0us          1us          2us
  backlog            0b           0b           0b
  pkts                0       610477          620
  bytes               0    840055670       127657
  way_inds            0         2190            0
  way_miss            0         3064            5
  way_cols            0            0            0
  drops               0            1            0
  marks               0            0            0
  ack_drop            0            0            0
  sp_flows            0            5            1
  bk_flows            0            1            0
  un_flows            0            0            0
  max_len             0        14980         1498
  quantum           300         1514          610

晚上10点掉包22%,CN2线路

掉包20 bbr+cake

https://gist.github.com/liberal-boy/c2e414165206451532874ea0da1d15cd

Lightmani commented 3 years ago

你的PING截图漏IP了

Ardentwheel commented 3 years ago

你的PING截图漏IP了

谢谢谢谢,😂

kslr commented 3 years ago

没有对比,感觉说服力不是很强

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days