CAKE w/ Adaptive Bandwidth

GNU Octave, version 9.1.0

Ah, most recent versions of the octave script should have that fixed, octave stopped supporting matlab style .- and .+ operators and just expects plain - and + instead.
(These operators will do addition and subtraction between two matrices of equal dimensions, individually for each element)

1 Like

Please try the latest version on the master branch:

https://raw.githubusercontent.com/lynxthecat/cake-autorate/master/fn_parse_autorate_log.m

1 Like

cake-autorate v3.2.0 has just been released.


What's Changed

  • This version focuses on reducing CPU usage for everyday use.
  • Fold pinger parsing and pinger maintenance processes into main process thereby to reduce IPC overhead. This involved a significant restructure of the code.
  • Reduce overhead associated with achieved rate monitoring.
  • Improve IPC read efficiency of the main process.
  • Use buffered log file writes.
  • Replace costly regex with alternatives.
  • Disable costly logging options by default.
  • Improve efficiency of load classification.
  • Reduce frequency of shaper rate updates on high load by only permitting shaper rate increases on load updates and increasing the default shaper rate increase factor to give the same overall increase rate.
  • Only print log file headers to log file corresponding with toggled logging stats.
  • Remove Starlink satellite switching code given insufficient evidence that it helps especially given recent improvements to Starlink connections.
  • Add simple CPU benchmark script.
  • Add support for devices running Asus Merlin.
  • Other minor fixes and improvements.

Full Changelog : v3.1.1...v3.2.0


Since the underlying control logic in cake-autorate has remained settled for some time now, it seemed apt to streamline the code and focus on reducing CPU usage with default settings.

On my RT3200 running OpenWrt 23.05.3, total CPU usage for cake-autorate now sits at around 6-8% with default settings.

5 Likes

Hello there

I face problems while setting up cake-autorate properly, while I did already mention that in the previous CAKE thread, due to time reasons, I couldn't continue then. Meanwhile I installed the the version 3.3.0 prerelease by using the installation guide on github by @Lynx

I did some logs and found out that cake-autorate stops running because my interfaces for upload/download are not correct. I am using the router as a dump AP with just a lan (br-lan) interface, so I am confused what to set for dl_if and ul_if in the config file.
screenshot

cake-autorate doesn’t set up the cake instances (it could, but that’d be for a different discussion), rather it is intended to alter the bandwidths of existing, already instantiated interfaces. So I think your question really is more about how to setup cake correctly for your use case, rather than how to setup cake-autorate for it.

So backtracking, do you have cake instances set up already? You can check for that by checking the output from:

tc qdisc ls

2 Likes

I enabled SQM in LuCi and chose cake as queue discipline

By using
tc qdisc ls

I get the following output:

/etc$ tc qdisc ls
qdisc noqueue 0: dev lo root refcnt 2 
qdisc mq 0: dev eth0 root 
qdisc fq_codel 0: dev eth0 parent :10 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :f limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :e limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :d limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :c limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :b limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :a limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :9 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :8 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :7 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :6 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :5 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :4 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :3 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1518 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64 
qdisc noqueue 0: dev lan3 root refcnt 2 
qdisc noqueue 0: dev lan2 root refcnt 2 
qdisc noqueue 0: dev lan1 root refcnt 2 
qdisc cake 8025: dev br-lan root refcnt 2 bandwidth 10Mbit besteffort triple-isolate nonat nowash no-ack-filter split-gso rtt 100ms raw overhead 0 
qdisc ingress ffff: dev br-lan parent ffff:fff1 ---------------- 
qdisc noqueue 0: dev phy1-ap0 root refcnt 2 
qdisc noqueue 0: dev phy0-ap0 root refcnt 2 
qdisc cake 8026: dev ifb4br-lan root refcnt 2 bandwidth 85Mbit besteffort triple-isolate nonat wash no-ack-filter split-gso rtt 100ms raw overhead 0

So it seems that you indeed have cake interfaces set up as: br-lan and ifb4br-lan?

Quick note on LAN-side directed interfaces like br-lan you likely will shape internet download with br-lan and internet upload with ifb4br-lan...

Sidenote, putting a qdiscs on a bridge interface is not completely without issues, in the old switchconfig world I think there was a dedicated device fro CPU-Switch that could be used, nit sure what we have for DSA nowadays...

Actually not, I just checked and set the original values for dl_if and ul_if (wan and ifb-wan) in the config.primary.sh file and still getting the br-lan mentioned after running the tc qdisc ls command. (If this is what you meant)

I now changed the interfaces according to the values @moeller0 suggested in the config file using WinSCP. Restarted cake-autorate but still getting horrible results while running the waveform.com bufferbloat tool...

Please post links to the waveform result page for your test and maybe collect and post a autorate logfile...
Also, please post the output of:
tc -s qdisc

I may be misunderstanding you, but it seems to me that there may be some confusion here.

Setting the interface names in the cake-autorate config only tells cake-autorate which interfaces to direct the bandwidth change calls to. It won’t affect which interfaces cake get setup on. So it won’t affect what you see when you run tc qdisc ls.

The point is that firstly you need to setup cake correctly and on the right interfaces. The cake bandwidths at this point are fixed. Static. No change.

Then, once the above first step has been completed, you need to tell cake-autorate which interfaces the cake instances have been setup on. The cake bandwidths are now variable. Non-static. They change.

I hope this makes sense.

I now understand what you mean regarding the basic concept. Unfortunately I am completely new to linux, so I can execute the commands with an instruction but have no clue what they actually do.

Is there any chance for an instruction on how to setup cake correctly? As far I know cake is already installed by downloading the luci-app-sqm and sqm-scripts packages. I thought the setup of cake was done after using LuCI for setting up SQM QoS.

Perhaps you could describe your setup and goals for traffic shaping in general? Then we can advise.

2 Likes

Sure, my goal is to play online games on a windows PC which at the moment is not possible most probably due to the high ping values I get under network load. My setup is the following:

4G SIM-card router (TP-Link Archer MR2000 ; running stock firmware)

Zxyel WSM20 (OpenWrt; V. 23.05.3) --> this acts as dumb AP

Both routers are connected physically by an ethernet-cable (lan bridge?)

further downstream I connected devices using 2 hosted Wireless networks from the Zyxel router (one 2.4 and one 5Ghz, but all my devices are connected to the 5Ghz network.)

Here is what I recommend. Does your 4G router support bridge mode? If so, enable it. And either way, you connect your 4G router to the WAN port of your Zyxel and have your Zyxel do the routing and shaping. You put cake on the WAN interface of your Zyxel. And you can put things like adblock-lean for ad-blocking on your Zyxel too.

1 Like

I would connect the gaming devices to the Zyxel via cables if possible...

The problem is when I connect the ethernet cable to the WAN port of my Zyxel I it does not work (cannot reach any of the 2 routers by their IP then), it seems it only works when I connect it to the LAN port. My TP-Link router does not support bridge mode, so I run the lan-brige on my Zyxel as a DHCP client.

@moeller0 That is possible!

I would fix that, even double NAT is desirable over your current setup... br-lan also bridges the WiFI in and I am not sure you really want to shape down WiFI as well.
This should work with stock OpenWrt settings, connect the wan port to the LTE modem and configure the wan to use dhcp...
HOWEVER, make sure that both use different IP ranges, so if the LTE router uses 192.168.0.0/24 for its LAN side you need the OpenWrt Zyxel LAN to something else!

1 Like