Ultimate SQM settings: Layer_cake + DSCP marks (New Script!)

Thanks @EXREYFOX and @Dopam-IT_1987 !
I have made the changes you two suggested and everything seem to be working.

I still do not understand the results of tc -s qdisc, so I'm posting it below for your gentlemen observations:

# tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 
 Sent 951412633 bytes 879521 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc cake 8014: dev eth1 root refcnt 2 bandwidth 85Mbit diffserv4 dual-srchost nat nowash no-ack-filter split-gso rtt 100ms noatm overhead 44 
 Sent 198614979 bytes 441328 pkt (dropped 997, overlimits 529376 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 198080b of 4250000b
 capacity estimate: 85Mbit
 min/max network layer size:           28 /    1492
 min/max overhead-adjusted size:       72 /    1536
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       5312Kbit       85Mbit    42500Kbit    21250Kbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay          1us         72us         52us         62us
  av_delay          0us         10us          3us          5us
  sp_delay          0us          2us          2us          1us
  backlog            0b           0b           0b           0b
  pkts                2       441876           99          348
  bytes             108    200046292        15130        53523
  way_inds            0         3620            0            0
  way_miss            1         3181           77           12
  way_cols            0            0            0            0
  drops               0          997            0            0
  marks               0            1            0            0
  ack_drop            0            0            0            0
  sp_flows            0            2            1            1
  bk_flows            0            2            0            0
  un_flows            0            0            0            0
  max_len            54        29880         1438          180
  quantum           300         1514         1296          648

qdisc fq_codel 0: dev eth5 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 
 Sent 129100426 bytes 196408 pkt (dropped 0, overlimits 0 requeues 4) 
 backlog 0b 0p requeues 4
  maxpacket 1494 drop_overlimit 0 new_flow_count 3 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc cake 800e: dev br-lan root refcnt 2 bandwidth 170Mbit diffserv4 dual-dsthost nat nowash ingress no-ack-filter split-gso rtt 100ms noatm overhead 44 
 Sent 951412587 bytes 879520 pkt (dropped 3190, overlimits 1104813 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 2416184b of 8500000b
 capacity estimate: 170Mbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       72 /    1544
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh      10625Kbit      170Mbit       85Mbit    42500Kbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay       1.68ms        248us         10us         21us
  av_delay        856us         58us          1us          8us
  sp_delay        141us          2us          1us          3us
  backlog            0b           0b           0b           0b
  pkts             1261       879662           42         1745
  bytes         1890436    953870874         4842       143395
  way_inds            0          853            0            0
  way_miss            1         5883            3          102
  way_cols            0            0            0            0
  drops               1         3189            0            0
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            0            2            1            1
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len         54216        61746          510         1406
  quantum           324         1514         1514         1296

qdisc cake 8011: dev eth5.210 root refcnt 2 bandwidth 510Mbit diffserv4 dual-srchost nat nowash no-ack-filter split-gso rtt 100ms noatm overhead 44 
 Sent 129097440 bytes 196393 pkt (dropped 2, overlimits 104234 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 880760b of 15140Kb
 capacity estimate: 510Mbit
 min/max network layer size:           28 /    1480
 min/max overhead-adjusted size:       72 /    1524
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh      31875Kbit      510Mbit      255Mbit   127500Kbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay          0us          8us          9us          9us
  av_delay          0us          5us          1us          1us
  sp_delay          0us          1us          1us          1us
  backlog            0b           0b           0b           0b
  pkts                0       196315           47           33
  bytes               0    129092985         5230         2213
  way_inds            0           22            0            0
  way_miss            0         1350           39            6
  way_cols            0            0            0            0
  drops               0            2            0            0
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            0            1            0            0
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len             0         1494          190          590
  quantum           972         1514         1514         1514

qdisc noqueue 0: dev wg0 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0

Thanks once again.
Cesar

PS: My son is not home until the weekend, so I really cannot test performance game wise, but since the rest of the family is still quiet, I take that as a good sign.

1 Like

if i not make error but again once time not expert the pckt could like here the screen

my dl is 68 et up 18 have a nice day

1 Like

Are you using any iptables, i see most or total of the packts go to CS0 (best effort)

This is mine :

OpenWrt 19.07.8, r11364-ef56c85848
 -----------------------------------------------------
root@OpenWrt:~# tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc mq 0: dev eth1 root 
 Sent 1513776304 bytes 5072074 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth1 parent :8 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :7 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :6 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :5 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :4 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :3 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 parent :1 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 1513776304 bytes 5072074 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc mq 0: dev eth0 root 
 Sent 6040441048 bytes 7947218 pkt (dropped 0, overlimits 0 requeues 220) 
 backlog 0b 0p requeues 220
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :7 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :6 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 6040441048 bytes 7947218 pkt (dropped 0, overlimits 0 requeues 220) 
 backlog 0b 0p requeues 220
  maxpacket 1514 drop_overlimit 0 new_flow_count 144 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc cake 800b: dev eth0.1 root refcnt 2 bandwidth 189Mbit diffserv4 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 42 
 Sent 6040423097 bytes 7947153 pkt (dropped 256, overlimits 4790537 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 1247524b of 9450000b
 capacity estimate: 189Mbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       70 /    1542
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh      11812Kbit      189Mbit    94500Kbit    47250Kbit
  target          5.0ms        5.0ms        5.0ms        5.0ms
  interval      100.0ms      100.0ms      100.0ms      100.0ms
  pk_delay        629us        272us          7us          4us
  av_delay        160us         29us          1us          1us
  sp_delay         17us          2us          1us          1us
  backlog            0b           0b           0b           0b
  pkts             1064      4314365          119      3631861
  bytes         1559927   4917150961        13256   1122047093
  way_inds            0       148376            0        17844
  way_miss            4        53859           24         2102
  way_cols            0            0            0            0
  drops               0          255            0            1
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            0            4            1            0
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len          9084        20704          678        14177
  quantum           360         1514         1514         1441

qdisc cake 8011: dev eth1.100 root refcnt 2 bandwidth 93600Kbit diffserv4 triple-isolate nonat nowash no-ack-filter split-gso rtt 100.0ms noatm overhead 42 
 Sent 1513750077 bytes 5071882 pkt (dropped 3, overlimits 3131711 requeues 0) 
 backlog 0b 0p requeues 0
 memory used: 154752b of 4680000b
 capacity estimate: 93600Kbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       70 /    1542
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       5850Kbit    93600Kbit    46800Kbit    23400Kbit
  target          5.0ms        5.0ms        5.0ms        5.0ms
  interval      100.0ms      100.0ms      100.0ms      100.0ms
  pk_delay          0us        124us          4us         16us
  av_delay          0us         10us          3us          2us
  sp_delay          0us          2us          2us          1us
  backlog            0b           0b           0b           0b
  pkts                0      1710478          659      3360748
  bytes               0    357959613        59310   1155734767
  way_inds            0        37313            0       123998
  way_miss            0        51729          659         2703
  way_cols            0            0            0            0
  drops               0            2            0            1
  marks               0            0            0            0
  ack_drop            0            0            0            0
  sp_flows            0            3            0            3
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len             0        14340           90        13626
  quantum           300         1514         1428          714

I only use to lines of iptables:

##udp ps4
iptables -t mangle -A POSTROUTING -p udp --dst 192.168.1.150 -j DSCP --set-dscp-class CS5
iptables -t mangle -A PREROUTING -p udp --src 192.168.1.150 -j DSCP --set-dscp-class CS5

##tcp ps4
iptables -t mangle -A POSTROUTING -p tcp --dst 192.168.1.150 -j DSCP --set-dscp-class CS4
iptables -t mangle -A PREROUTING -p tcp --src 192.168.1.150 -j DSCP --set-dscp-class CS4

And this is mine etc/config/sqm:

config queue 'eth1'
	option enabled '1'
	option interface 'eth1.100'
	option upload '93600'
	option debug_logging '0'
	option verbosity '5'
	option qdisc 'cake'
	option script 'layer_cake.qos'
	option download '0'
	option qdisc_advanced '0'
	option linklayer 'ethernet'
	option overhead '42'

config queue
	option debug_logging '0'
	option verbosity '5'
	option interface 'eth0.1'
	option download '0'
	option upload '189000'
	option qdisc 'cake'
	option script 'layer_cake.qos'
	option enabled '1'
	option qdisc_advanced '0'
	option linklayer 'ethernet'
	option overhead '42'

In adiction i use a mnged switch ( edge switch-24 lite) and use qos/

This switch have more configs to mark dscp packts without a need of iptables in the firewall but i cant setup (advanced users), but with this my game fills fuid

1 Like

this is mine 50/15 diffserv8

ugly-details
qdisc cake 800c: dev eth1 root refcnt 2 bandwidth 17980Kbit diffserv8 triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms raw overhead 0 
 Sent 36621156 bytes 175846 pkt (dropped 15, overlimits 47846 requeues 0) 

                  Tin 0        Tin 1        Tin 2        Tin 3        Tin 4        Tin 5        Tin 6        Tin 7
  thresh      17980Kbit    15732Kbit    13765Kbit    12045Kbit    10539Kbit     9222Kbit     8069Kbit     7060Kbit
  target            5ms          5ms          5ms          5ms          5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms        100ms        100ms        100ms        100ms
  pk_delay          0us         28us       1.08ms       2.18ms         24us          0us        186us       1.02ms
  av_delay          0us          3us         57us        275us          4us          0us         10us         98us
  sp_delay          0us          2us          2us         17us          2us          0us          2us          3us
  backlog            0b           0b           0b           0b           0b           0b           0b           0b
  pkts                0         5850         6558        26178        45979            0        85313         5983
  bytes               0       533438       599429      6762235      5943620            0     21985737       816699
  way_inds            0            0           42            0           10            0         1840          524
  way_miss            0           91          371          680         1327            0         3871         3133
  way_cols            0            0            0            0            0            0            0            0
  drops               0            0            0            9            1            0            5            0
  marks               0            0            0            0            0            0           13            0
  ack_drop            0            0            0            0            0            0            0            0
  sp_flows            0            1            0            0            0            0            0            0
  bk_flows            0            0            0            0            0            0            1            0
  un_flows            0            0            0            0            0            0            0            0
  max_len             0          869         2500         1825         1514            0        10598         1414
  quantum           548          480          420          367          321          300          300          300


qdisc cake 800d: dev ifb4eth1 root refcnt 2 bandwidth 51470Kbit diffserv8 triple-isolate nonat wash no-ack-filter split-gso rtt 100ms raw overhead 0 
 Sent 592394261 bytes 480267 pkt (dropped 440, overlimits 746596 requeues 0) 

                  Tin 0        Tin 1        Tin 2        Tin 3        Tin 4        Tin 5        Tin 6        Tin 7
  thresh      51470Kbit    45036Kbit    39406Kbit    34480Kbit    30170Kbit    26399Kbit    23099Kbit    20212Kbit
  target            5ms          5ms          5ms          5ms          5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms        100ms        100ms        100ms        100ms
  pk_delay          0us          0us       2.63ms       1.71ms       1.69ms          0us       3.63ms        678us
  av_delay          0us          0us        533us        167us        614us          0us       2.85ms        219us
  sp_delay          0us          0us          2us          1us          2us          0us          2us          3us
  backlog            0b           0b           0b           0b           0b           0b           0b           0b
  pkts                0            0        85474       124219       226139            0        35621         9254
  bytes               0            0     75634147    161974016    321495197            0     27161404      6772935
  way_inds            0            0          581           20          147            0           18          221
  way_miss            0            0         4810          998         2658            0         2041         2760
  way_cols            0            0            0            0            0            0            0            0
  drops               0            0           34          141          229            0           32            4
  marks               0            0           24            0            0            0            0            0
  ack_drop            0            0            0            0            0            0            0            0
  sp_flows            0            0            1            0            1            0            0            0
  bk_flows            0            0            0            0            0            0            0            0
  un_flows            0            0            0            0            0            0            0            0
  max_len             0            0        13446        13493        14840            0        18120         9084
  quantum          1514         1374         1202         1052          920          805          704          616

(tins 6 + 7 ~ upload are somewhat cramped... i'm cheating with some web bursts in there or something I think for you guys would be accidentally stuffing too much gaming here (i.e. EF) maybe...)

1 Like

Hmm, so what this will do on a normal link is to massively throttle all flows that ever queue more than one packet, so at least run a speedtest (from a different computer) parallel to your gaming session to assess the utilization cost inflicted on making cake drop/mark that aggressively. Well, possible that you are happy with the trade-off you are making, but please make sure you know what you are getting yourself into :wink: Also note that a smaller interval will make cake more RTT-biased, that is flows with RTTs considerable larger than cake's hidden interval (so 0.1ms for daracentre) will see less throughput than flows with RTT closer to 0.1ms, again this consequence might be acceptable to you, but to make an educated decisiion, you might want to know the details.

Well, the target defines the acceptable persistent queuing delay, so as long as the currently experienced sojourn time stays below that threshold cake will neither drop nor mark a packet. Cake tries to automatically scale the target such that it allows at least 1.5 times the MTU, so I am doubtful, that when requesting datacentre you actually got 0.05/0.1 ms configured. If you could post the output of tc -s qdisc here we might be able to figure out which parameters cake actually used....

1 Like

Like I mentioned earlier, this thing is the most complicated thing I have ever seen in many years... It's like black magic, only accessible to a few wizards...

As far as I can tell, I'm only using two:

$IPT -t mangle -A PREROUTING -p tcp -m conntrack --ctorigsrc 192.168.1.150 -m multiport ! --ports 80,443,8080 -j DSCP --set-dscp-class CS6 -m comment --comment "PS4" #for PS4 or xbox etc, change the ip according to your ip setting.
$IPT -t mangle -A PREROUTING -p udp -m conntrack --ctorigsrc 192.168.1.150 -m multiport ! --ports 80,443,8080 -j DSCP --set-dscp-class CS6 -m comment --comment "PS4"

I don't know, but since my son is not home until de weekend and, of course, the PS4 is off, maybe that explains why we don't see packets going elsewhere.

Exactly the drop would be exorbitant at least for my download speed 15mbps (capped at 14.5mbps) shows 13mbps with datacenter and without it shows 13.8mbps.

I didn't understand what do you mean?

Okay thanks for clarification :smiley:

Okay here:

So what you see in there is that cake adjusted the target up to 1.25-3.19ms (which is roughly 1.5 times the duration required to transmit a full MTU sizes packet) a far cry from the requested 0.05 ms, the interval however was only upscaled to the default minimum of two times the target. That still means that cake is much more prone to drop/mark packets due to the low interval setting, but at least the sojourn time is sane.

So a speedtest with the effective ~2/4ms target/interval combination only gives you a reduction by 100-100*13/13.8 = 5.8%? Not that bad, I guess the question then is how this affects throughput to/from servers further away.

BTW with your settings you can expect at best:
14.5 * ((1500-8-20-20)/(1500+14)) = 13.91 Mbps throughput, so 13.8 is already pretty much spot on*

*) or would be if speedtests would not generally tend to overestimate the speed a bit.

1 Like

This "datacenter" exploration is very interesting. Good stuff @AlanDias17 .

2 Likes

Because you have two WANs this is not going to work exactly correctly the LAN side queue will be getting packets from both WANs and so will control only the aggregate speed, this is not really enough to stop bufferbloat on both WANs. It will work reasonably well much of the time but if any stream is saturating one of the WANs it will not be throttled by a queue that only throttles the total speed.

To solve this, you could add queues on download of each WAN, perhaps using simplest qos just to control the speed on each WAN separately.

2 Likes

Thanks for chiming in about this particular scenario and all the knowledge you've been sharing in this and other threads. :+1:t2:
I will try your suggestion once I get home tonight and post back with the results.

2 Likes

Absolutely which aids benefit for us gamers at the cost of speed. I was thinking is there a way we can customize shaper to send game packets as soon as they arrive? Especially when the network is congested.

How can we test that?

hello everyone

my tc qdisc after many games

Just putting it here for anyone wondering meaning of tc -s qdisc table values it is discussed in this post SQM Reporting

In terms of cake output, cake can be viewed as an overall shaper with traffic classified into groups called Tins. A cake instance can have 1, 3, 4 or 8 tins. A 4 tin configured cake looks like:

qdisc cake 8081: root refcnt 9 bandwidth 19900Kbit diffserv4 dual-srchost nat nowash ack-filter split-gso rtt 100.0ms ptm overhead 26 mpu 72 
 Sent 100593447 bytes 224203 pkt (dropped 7430, overlimits 326315 requeues 64) 
 backlog 0b 0p requeues 64
 memory used: 237416b of 4Mb
 capacity estimate: 19900Kbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       74 /    1550
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       1243Kbit    19900Kbit     9950Kbit     4975Kbit
  target         14.6ms        5.0ms        5.0ms        5.0ms
  interval      109.6ms      100.0ms      100.0ms      100.0ms
  pk_delay        764us        2.5ms         43us         72us
  av_delay        117us        279us         29us         16us
  sp_delay          6us         23us         21us         16us
  backlog            0b           0b           0b           0b
  pkts            45927       184129         1260          317
  bytes        15150132     87582439        79573        16302
  way_inds          360          754            0            0
  way_miss          257         1312          216            2
  way_cols            0            0            0            0
  drops              33         1145            0            0
  marks               0            0            0            0
  ack_drop         4936         1316            0            0
  sp_flows            1            0            1            1
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len         11245         7570          603           54
  quantum           300          607          303          300

qdisc ingress ffff: parent ffff:fff1 ---------------- 
 Sent 234180120 bytes 245510 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0

For the 3 & 4 tin category instances of cake, the tins are given a descriptive name, the other instances they're just called 'Tin 'n''. Tins on the left have lower priority than tins on the right. Tin selection is (usually) determined by the packet's DSCP value. In terms of the stats values reported here's what they mean AFAIUI.

Thres: Defines how much bandwidth is consume in this tin before it switches to a lower priority. In the above example, voice is guaranteed 5Mbit of bandwidth. If video needed up to 10Mbit and voice was consuming more than 5Mbit, video would start stealing bandwidth from voice until the bandwidth minimums were reached. They're soft limits in that anyone can have all of the bandwidth as long as no one with higher priority needs it.

target: the 'ideal' target delay that we'll tolerate for an individual flow. ie. how old stuff can be in the queue before we'll consider taking action, like shooting packets to tell people to slow down.

interval: I need to check this!

pk_delay: peak packet delay, the oldest packet we had in the queue, ie. how long the oldest packet hung around before we got to dequeue it.
av_delay: the average delay of the packets in the queue that we dequeued.
sp_delay: the delay in the queue for sparse packets. Oh boy: packet flows that send on a continuous basis are regarded as 'bulk' flows (ftp transfer). Packets that flow occasionally are regarded as 'sparse' (think interactive ssh). So this tells you how delayed the 'interactive' packets have been.
NB: All the above delay stats are EWMA averages so they can lag slightly or if there's no packet in a tin it can appear to stall.

backlog: number of bytes in the queue, waiting to be sent when the shaper says there's space/time to be able to send.
pkts(c): number of packets that have flowed through this tin
bytes(c): number of bytes that have flowed through this tin
way_inds(c), way_miss(c), way_cols(c): Each packet flow is ideally put into an individual queue, these are almost like cache stats and show how succesful we were in achieving that. Mostly uninteresing.
drops(c): number of packets we dropped as part of our queue control mechanism
marks(c): number of packets we ECN marked (on ECN capable flows) in preference to dropping them.
ack_drop(c): If ack-filtering enabled, number of unnecessary ack only packets that were dropped.
sp_flows: the number of sparse packet flows in this tin
bk_flows: the number of bulk packet flows in this tin
un_flows: the number of unresponsive packet flows in this tin. If a flow doesn't respond to codel style 'slow down' signalling in a normal manner then it is considered unresponsive and is handled by the 'blue' aqm instead.
maxlen: the largest packet we've seen in the queue.
quantum: granularity in bytes of how much we can de-queue in our queues and release to the shaper.

Most of the figures are an instantaneous snapshot or 'gauge' of the current state, I've indicated with a (c) where the values accumulate and thus would need 2 samples over time to produce a 'rate'

In terms of key performance display I think:

Traffic rate (bytes - prev_bytes)
backlog
pk, av, sp delays (vs target)
drops rate
marks rate
sparse, bulk, unresponsive flows

1 Like

I can help here, from CoDel's RFC which mostly applies to cake as well:

4.2. Setting INTERVAL The INTERVAL value is chosen to give endpoints time to react to a drop without being so long that response times suffer. CoDel's estimator, TARGET, and control loop all use INTERVAL. Understanding their derivation shows that CoDel is the most sensitive to the value of INTERVAL for single long-lived TCPs with a decreased sensitivity for traffic mixes. This is fortunate, as RTTs vary across connections and are not known a priori. The best policy seems to be to use an INTERVAL value slightly larger than the RTT seen by most of the connections using a link, a value that can be determined as the largest RTT seen if the value is not an outlier (use of a 95-99th percentile value should work). In practice, this value is not known or measured (however, see Appendix A for an application where INTERVAL is measured). An INTERVAL setting of 100 ms works well across a range of RTTs from 10 ms to 1 second (excellent performance is achieved in the range from 10 ms to 300 ms). For devices intended for the normal terrestrial Internet, INTERVAL SHOULD have a value of 100 ms. This will only cause overdropping where a long-lived TCP has an RTT longer than 100 ms and there is little or no mixing with other connections through the link.

Think about interval like this, codel/cake will only engage in scheduling a drop/mark, if the minimum delay in a bucket/flow has been > target for at least a full interval period, and then it will drop/mark immediately and also schedule the next drop time in the future based on doings its inverse square law calculations using on the same interval value as starting value. In short, the smaller interval is the drop/mark happier CoDel/cake become, and the more utilization/throughput will take a hit (latency for non-queueing flows however should be better).

The last part is important, these are not simple to interpret value, but exponentially weighted moving averages, especially in the case of pk_delay, this is not simply the maximum delay a packet experienced. Arguably it would be helpful to get the true maximum sojourn time since the last statistics query as well, but cake does not offer that currently.

BTW, the link you supplied results in a:
" Oops! That page doesn’t exist or is private."

error page.

2 Likes

I think it's probably this post -

2 Likes

Many thanks for this explanation. It makes things a little clearer.

a question, if I put in sqm the same value in both download and upload (for example 10000kbps) I do a test with dslreport, why upload is it always the half of the download?does anyone know the answer?

Okay updated the link hope it's fixed. Also, thanks @moeller0 for in-depth explanation. The more we understand, easier it becomes :wink: