SQM Cake slowing down connection alot

Hello currently have an old router (r8000) set up with the latest version of LEDE and have the SQM scripts enabled. My download speed is 400mb down and 45mb up. I followed the main guide and set up the connection speeds at around 85% of my speeds (365000kbx36000kb.) My upload speeds seem to be fine at 34.6mb but my download speed is crawling at 34mb. I know for gaming (overwatch via ethernet) those speeds are prob perfect and my buffer bloat is A+. I tried both layer and piece of cake but they both slow me down. Also, this is a noob question but what interface should I use? I am connected to LAN port 0 however interface says lan is 0.2 (oddly enough no matter what interface i select the sqm seems to be running.) If you need any logs or more information just ask and i would be glad to give them to you.

There is likely not much you can do. A combined shaped throughput of 35+35=70 mbit sounds quite typical for an older router.
You are likely CPU constrained. Likely top or htop will show that CPU utilization is 100%.

Make sure you run it on your WAN interface, not your LAN. Otherwise local traffic will also be shaped, which you don't want. Only incoming and outgoing traffic to the internet needs to be shaped. And as Hnyman mentioned, your older router is severely bottlenecking SQM's performance. You would need to upgrade or disable SQM.

I concur with @hnyman, a total of 445Mbps is quite hard for a software shaper like cake, you will need quite capable hardware to allow that.

This could just show your router running out of CPU at ~34Mbps, but it also could mean that you instantiated the shaper on a LAN interface, in that case the "download" field in luci-app-sqm will actually control the upload (in reality download should be called ingress and upload egress; these names indicate the fact that the directionality is always in relation to the actual ethernet interface and not the internet. Thing about it packets leaving an interface are "egress", but for the WAN interface that corresponds to internet upload, while for a LAN interface (connected to internal hosts) the same leaving egress packets now correspond with internet downloads).

Could you please post the output of (log into your router via SSH* and issue the commands below without the double quotes):
"cat /etc/config/sqm"
"tc -s qdisc"

and a link to the detailed results of a dslreports speedtest (see https://forum.openwrt.org/t/sqm-qos-recommended-settings-for-the-dslreports-speedtest-bufferbloat-testing/2803 for recommendations how to configure that test). Ideally you would run that test once without sqm enabled (log into the router and issue "/etc/init.d/sqm stop") and once with sqm enabled ("/etc/init.d/sqm stop")

If at all piece_of_cake.qos should be slightly less expensive CPU-wise.

*) See https://www.turris.cz/doc/en/howto/ssh for instructions how to ssh into your router. I guess you already know that, but in the spirit of making this thread maximally useful to other's stumbling over it I wanted to add that here.

Like most people said already your router's CPU is probably the cause of the issue.
Also 85% is quite low, you loose 15% of your Internet connection. I would start from 90% if you're using number provided by your ISP (400/45) or 95% if you're going to be using numbers from a speedtest.

This one is a good one.
https://www.dslreports.com/speedtest

My measured speed is around 13Mbps, after enabling piece of cake SQM model it is around 9Mbps. The router is a WNDR3700, cpu is absolutely not used when I do a speedtest (htop).

It is normal?

Yes. Wndr3700 can't do much more than 80-90 mbit/s with SQM shaping active.
If you look closely to the CPU stats, it is 100% loaded and mainly for sirq meaning that the network driver consumes the time.

Older discussion in https://forum.openwrt.org/viewtopic.php?pid=250834#p250834

80/90 Mbps? Or you mean 8-9Mbps?

With 1 connected device doing a speedtest:

Or top:

Mem: 43424K used, 16972K free, 1576K shrd, 4384K buff, 12804K cached
CPU: 0% usr 0% sys 0% nic 88% idle 0% io 0% irq 10% sirq
Load average: 0.14 0.04 0.23 1/71 10581

...I am not even close to 100% CPU.

Could you post the output of:

cat /etc/config/sqm
tc -d qdisc
tc -s qdisc

all run from your routers command prompt please?

Best Regards

Sure.

config queue 'eth1'
	option interface 'eth1'
	option qdisc_advanced '0'
	option debug_logging '0'
	option verbosity '5'
	option qdisc 'cake'
	option script 'piece_of_cake.qos'
	option linklayer 'atm'
	option overhead '44'
	option download '11685'
	option upload '700'
	option enabled '1'

root@LEDE:~# tc -d qdisc
qdisc noqueue 0: dev lo root refcnt 2 
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
qdisc cake 800a: dev eth1 root refcnt 2 bandwidth 700Kbit besteffort triple-isolate rtt 100.0ms raw 
 linklayer atm overhead 44 mtu 2047 tsize 512 
qdisc ingress ffff: dev eth1 parent ffff:fff1 ---------------- 
qdisc noqueue 0: dev br-lan root refcnt 2 
qdisc noqueue 0: dev eth0.1 root refcnt 2 
qdisc fq_codel 0: dev pppoe-wan root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
qdisc fq_codel 0: dev tun0 root refcnt 2 limit 10240p flows 1024 quantum 1500 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
qdisc cake 800b: dev ifb4eth1 root refcnt 2 bandwidth 11685Kbit besteffort triple-isolate wash rtt 100.0ms raw 
 linklayer atm overhead 44 mtu 2047 tsize 512

root@LEDE:~# 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 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 1306309429 bytes 1059330 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 800a: dev eth1 root refcnt 2 bandwidth 700Kbit besteffort triple-isolate rtt 100.0ms raw 
 Sent 82729237 bytes 245146 pkt (dropped 15886, overlimits 537251 requeues 0) 
 backlog 0b 0p requeues 0 
 memory used: 339264b of 4Mb
 capacity estimate: 700Kbit
                 Tin 0
  thresh       700Kbit
  target        26.0ms
  interval     121.0ms
  pk_delay      52.2ms
  av_delay       4.7ms
  sp_delay        14us
  pkts          261032
  bytes       92190744
  way_inds        6691
  way_miss        5390
  way_cols           0
  drops          15886
  marks              0
  sp_flows           0
  bk_flows           1
  un_flows           0
  max_len         1749

qdisc ingress ffff: dev eth1 parent ffff:fff1 ---------------- 
 Sent 375954826 bytes 330955 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc noqueue 0: dev br-lan root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc noqueue 0: dev eth0.1 root refcnt 2 
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0 
qdisc fq_codel 0: dev pppoe-wan root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 135335066 bytes 887876 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 tun0 root refcnt 2 limit 10240p flows 1024 quantum 1500 target 5.0ms interval 100.0ms memory_limit 4Mb ecn 
 Sent 25021751 bytes 26104 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 800b: dev ifb4eth1 root refcnt 2 bandwidth 11685Kbit besteffort triple-isolate wash rtt 100.0ms raw 
 Sent 443810287 bytes 330017 pkt (dropped 1094, overlimits 402634 requeues 0) 
 backlog 0b 0p requeues 0 
 memory used: 208320b of 4Mb
 capacity estimate: 11685Kbit
                 Tin 0
  thresh     11685Kbit
  target         5.0ms
  interval     100.0ms
  pk_delay       846us
  av_delay        61us
  sp_delay         6us
  pkts          331111
  bytes      445691363
  way_inds        1377
  way_miss        5423
  way_cols           0
  drops           1094
  marks              0
  sp_flows           0
  bk_flows           1
  un_flows           0
  max_len         1749

If I disable SQM I immediately get the full speed. If it was a CPU problem, I can accept it, but as I checked the CPU is not used at all.

Okay, that seems simple at that setting your gross ATM rate is kept below 11685/700 Kbps, but your speedtest measures Goodput. And with the shaper bandwidth you configured you can at best expect (TCP/IPv4 goodput, no tcp options):
download:
With ATM/AAL5 each packet will be encapsulated in an integer number of 48 byte ATM cells (that are padded aif need be after each packet), so with maxlen 1749 this indicated 33 ATM cells per full MTU packet or 33 * 48 = 1584
11685 * (48/53) * ((1500 - 8 - 20 - 20)/(1584)) = 9700.75
700 * (48/53) * ((1500 - 8 - 20 - 20)/(1584)) = 581.132075472

So I would say, you get what you asked sqm for, no? I guess it is not obvious that you specify gross bandwidth instead of the goodput you typically measure, but if you start thinking about the details you might realize that there really is no other option....
Oh, please d not forget that for the downstream shaper to work you will need to sacrifice some bandwidth. And setting the link layer to ATM will account for the 48/53 encoding, which by itself will alreadt cost you 100-100*48/53 = 9.4% Goodput. I would try to look at the sync rate in the DSL modem/router and use this as a basis for configuring SQM, say take 90% of the sync with the sqm settings you showed and test whether this controls bufferbloat well enough for your taste...
Best Regards
P.

2 Likes

Thanks for the detailed explanation. Tomorrow I am going to tune a little bit with the modem sync rate.

If you are not 100% about the overhead 44 section, have a look at:
https://github.com/moeller0/ATM_overhead_detector
Also have a look at https://lede-project.org/docs/howto/sqm to get better idea what is possible with sqm/cake. Also under the link layer adjustments tab in the GUI select the advanced options checkbox and set the link layer adjustment method to cake (which should be more versatile than the default tc_stab mechanism, especially as cake tries to handle the kernel's automatic addition of 14 bytes for ethernet interfaces).

Best Regards