CAKE w/ Adaptive Bandwidth

The bane of being a noob on a new forum lmaoo. I opened your profile but don't see a way to message you. Want to send me one? Then I can respond.

Got it - here it is for the interested readers:

1 Like
Samples per reflector:
ReflectorID: 1.0.0.1; N: 70
ReflectorID: 1.1.1.1; N: 70
ReflectorID: 156.154.70.2; N: 69
ReflectorID: 156.154.71.5; N: 72
ReflectorID: 208.67.220.220; N: 71
ReflectorID: 9.9.9.10; N: 71
DL: maximum 95.000%-ile delta delay over all 6 reflectors: 3.505 ms.
DL: maximum 99.000%-ile delta delay over all 6 reflectors: 8.265 ms.
DL: maximum 99.500%-ile delta delay over all 6 reflectors: 8.265 ms.
DL: maximum 99.900%-ile delta delay over all 6 reflectors: 8.265 ms.
DL: maximum 99.950%-ile delta delay over all 6 reflectors: 8.265 ms.
DL: maximum 99.990%-ile delta delay over all 6 reflectors: 8.265 ms.
DL: maximum 99.999%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 95.000%-ile delta delay over all 6 reflectors: 3.505 ms.
UL: maximum 99.000%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 99.500%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 99.900%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 99.950%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 99.990%-ile delta delay over all 6 reflectors: 8.265 ms.
UL: maximum 99.999%-ile delta delay over all 6 reflectors: 8.265 ms.

Timeseries:

Raw CDFs:

Delta CDFs:

OK so we see that cake-autorate is never punishing your bandwidth because the delta thresholds are set too high for your cable connection:

The latency threshold is set to 30ms each way (i.e. 60ms RTT), but yours sits around 6ms each way (i.e. 12ms RTT total).

I'd try something like this:

dl_avg_owd_delta_max_adjust_up_thr_ms=8.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_up_thr_ms=8.0 # (milliseconds)

dl_owd_delta_delay_thr_ms=10.0 # (milliseconds)
ul_owd_delta_delay_thr_ms=10.0 # (milliseconds)

dl_avg_owd_delta_max_adjust_down_thr_ms=20.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_down_thr_ms=20.0 # (milliseconds)

But this might be too brutal.

Just edited my post with suggested config entries. This might be very brutal. But let's see if it improves your waveform-measured latency under load.

Right on. Do I just add it into the bottom of /root/cake-autorate/config.primary.sh? Under here?

### See defaults.sh for additional configuration options
### that can be set in this configuration file to override the defaults.
### Place any such overrides below this line.

I edited it in, here is the test result: https://www.waveform.com/tools/bufferbloat?test-id=bb9715a1-959d-437b-a6b1-b4e5f8181f47

root@OpenWrt:~/cake-autorate# cat /root/cake-autorate/config.primary.sh
#!/usr/bin/env bash
# *** INSTANCE-SPECIFIC CONFIGURATION OPTIONS ***
#
# cake-autorate will run one instance per config file present in the directory where
# cake-autorate is found (typically /root/cake-autorate). The config files must be in
# the directory in the form: config.instance.sh. Thus multiple instances of cake-autorate
# can be established by setting up appropriate config files like config.primary.sh and
# config.secondary.sh for the respective first and second instances of cake-autorate.

### For multihomed setups, it is the responsibility of the user to ensure that the probes
### sent by this instance of cake-autorate actually travel through these interfaces.
### See ping_extra_args and ping_prefix_string

dl_if=ifb4eth1 # download interface
ul_if=eth1     # upload interface

# Delta thresholds
dl_avg_owd_delta_max_adjust_up_thr_ms=8.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_up_thr_ms=8.0 # (milliseconds)

dl_owd_delta_delay_thr_ms=10.0 # (milliseconds)
ul_owd_delta_delay_thr_ms=10.0 # (milliseconds)

dl_avg_owd_delta_max_adjust_down_thr_ms=20.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_down_thr_ms=20.0 # (milliseconds)

# Set either of the below to 0 to adjust one direction only
# or alternatively set both to 0 to simply use cake-autorate to monitor a connection
adjust_dl_shaper_rate=1 # enable (1) or disable (0) actually changing the dl shaper rate
adjust_ul_shaper_rate=1 # enable (1) or disable (0) actually changing the ul shaper rate
min_dl_shaper_rate_kbps=56100  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=280500 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=504900  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=2100  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=10500 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=20000  # maximum bandwidth for upload (Kbit/s)

connection_active_thr_kbps=2000  # threshold in Kbit/s below which dl/ul is considered idle

# Logging toggles for various stats
output_processing_stats=1 # enable (1) or disable (0) output monitoring lines showing processing stats
output_load_stats=1       # enable (1) or disable (0) output monitoring lines showing achieved loads
output_reflector_stats=1  # enable (1) or disable (0) output monitoring lines showing reflector stats
output_summary_stats=1    # enable (1) or disable (0) output monitoring lines showing summary stats
output_cpu_stats=1        # enable (1) or disable (0) output monitoring lines showing CPU usage percentages
output_cpu_raw_stats=1    # enable (1) or disable (0) output monitoring lines showing raw CPU usage lines

# *** OVERRIDES ***

### See defaults.sh for additional configuration options
### that can be set in this configuration file to override the defaults.
### Place any such overrides below this line.
w this line.
root@OpenWrt:~/cake-autorate#

1 Like

Try running:

tail -f /var/log/cake-autorate.primary.log | grep SUMMARY

And observe whether the CAKE bandwidth is getting adjusted as you download a very large file.

You can also have a seperate terminal open with:

ping -i 0.1 1.1.1.1

And observe how RTT varies - is it to within the constraints you desire?

For example, you could try running CAKE with fixed bandwidth of 5 MBit/s in each direction. Presumably you want cake-autorate to allow only a small latency excursion from that optimal case, and you can tweak the thresholds to achieve the bandwidth/latency profile you desire.

I think the download is great, but the ping is still a little high.

Here is where I noticed some really high ping, outside of that I think the rest of the pings looked pretty good and were consistent enough:

SUMMARY; 2025-02-21-18:28:45; 1740162525.231171; 426512; 12792; 0; 0; 6221; 6221; dl_high; ul_high; 461841; 16240
SUMMARY; 2025-02-21-18:28:45; 1740162525.301132; 456141; 12770; 1; 0; 6436; 6436; dl_high; ul_high; 480314; 16889
SUMMARY; 2025-02-21-18:28:45; 1740162525.345143; 456141; 12770; 2; 1; 7301; 7301; dl_high; ul_high; 480314; 16889
SUMMARY; 2025-02-21-18:28:45; 1740162525.475060; 456141; 12770; 3; 2; 14377; 14377; dl_high_bb; ul_high; 425366; 16889
SUMMARY; 2025-02-21-18:28:45; 1740162525.493712; 470096; 12788; 4; 3; 19346; 19346; dl_high_bb; ul_low_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.513113; 470096; 12788; 5; 4; 20943; 20943; dl_high_bb; ul_low_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.548128; 470096; 12788; 6; 5; 22291; 22291; dl_high_bb; ul_low_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.592274; 470096; 12788; 5; 5; 22206; 22206; dl_high_bb; ul_low_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.652869; 470096; 12788; 5; 5; 22787; 22787; dl_high_bb; ul_low_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.719268; 422289; 10992; 5; 5; 17926; 17926; dl_high_bb; ul_high_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.755972; 422289; 10992; 5; 5; 15090; 15090; dl_high_bb; ul_high_bb; 425366; 13226
SUMMARY; 2025-02-21-18:28:45; 1740162525.808130; 422289; 10992; 5; 5; 13921; 13921; dl_high_bb; ul_high_bb; 381400; 12144
SUMMARY; 2025-02-21-18:28:45; 1740162525.848429; 422289; 10992; 5; 5; 13894; 13894; dl_high_bb; ul_high_bb; 381400; 12144
SUMMARY; 2025-02-21-18:28:45; 1740162525.892917; 407126; 11027; 5; 5; 13901; 13901; dl_high_bb; ul_high_bb; 381400; 12144
SUMMARY; 2025-02-21-18:28:45; 1740162525.942262; 407126; 11027; 4; 4; 12991; 12991; dl_high_bb; ul_high_bb; 381400; 12144
SUMMARY; 2025-02-21-18:28:45; 1740162525.992124; 407126; 11027; 3; 3; 11232; 11232; dl_high_bb; ul_high_bb; 381400; 12144
SUMMARY; 2025-02-21-18:28:46; 1740162526.036715; 407126; 11027; 2; 2; 9581; 9581; dl_high; ul_high; 381400; 12144
SUMMARY; 2025-02-21-18:28:46; 1740162526.086200; 378476; 10323; 1; 1; 8421; 8421; dl_high; ul_high; 381400; 12144
SUMMARY; 2025-02-21-18:28:46; 1740162526.143670; 378476; 10323; 0; 0; 7279; 7279; dl_high; ul_high; 396656; 12629
SUMMARY; 2025-02-21-18:28:46; 1740162526.183017; 378476; 10323; 0; 0; 6412; 6412; dl_high; ul_high; 396656; 12629
SUMMARY; 2025-02-21-18:28:46; 1740162526.228597; 378476; 10323; 0; 0; 5187; 5187; dl_high; ul_high; 396656; 12629

Here is a copy of the log: https://easyupload.io/1ymmvw

Yes this looks better to me in the sense that cake-autorate is now controlling your bandwidth based on latency:

So you are seeing up to 25ms (50ms RTT) deltas, and want to reduce this even further?

Maybe let's try increasing the ping response frequency and reducing the hits required for detection of bloat:

no_pingers=10
reflector_ping_interval_s=0.2

bufferbloat_detection_window=12   # number of samples to retain in detection window
bufferbloat_detection_thr=4      # number of delayed samples for bufferbloat detection

And let's also punish bufferbloat more:

shaper_rate_min_adjust_down_bufferbloat=0.95    # how rapidly to reduce shaper rate upon detection of bufferbloat (min reduction)
shaper_rate_max_adjust_down_bufferbloat=0.5    # how rapidly to reduce shaper rate upon detection of bufferbloat (max reduction)

Can you post links to waveform bufferbloat tests with and without these changes?

BTW whilst the cake-autorate defaults should always be adjusted to optimise settings for a given connection based on the preferences of the user, this is especially necessary here because the default settings are tailored for a 4G connection (mine). Your variable bandwidth cable connection is rather different - for example, the latencies are much smaller.

1 Like

i have it installed on asus merlin on rtax58u, the difference is amazing. The result is between Default CAKE enabled and CAKE-autorate enabled from SSH:

3 Likes

Hello

I´m new to it.
I try to improve with Cake autorate, i installed it on my Flint 2, i set parameters like this in autorate.sh

dl_if=ifb4pppoe-wan # download interface
ul_if=pppoe-wan # upload interface
adjust_dl_shaper_rate=1 # enable (1) or disable (0) actually changing the dl shaper rate
adjust_ul_shaper_rate=1 # enable (1) or disable (0) actually changing the ul shaper rate
min_dl_shaper_rate_kbps=350000 # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=480000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=495000 # maximum bandwidth for download (Kbit/s)
min_ul_shaper_rate_kbps=100000 # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=180000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=190000 # maximum bandwidth for upload (Kbit/s)
output_load_stats=0 # enable (1) or disable (0) output monitoring lines showing achieved loads
output_reflector_stats=0 # enable (1) or disable (0) output monitoring lines showing reflector stats
output_summary_stats=1 # enable (1) or disable (0) output monitoring lines showing summary stats
output_cpu_stats=0 # enable (1) or disable (0) output monitoring lines showing CPU usage percentages
output_cpu_raw_stats=0 # enable (1) or disable (0) output monitoring lines showing raw CPU usage lines
dl_avg_owd_delta_max_adjust_up_thr_ms=10.0
ul_avg_owd_delta_max_adjust_up_thr_ms=10.0
dl_owd_delta_delay_thr_ms=30.0
ul_owd_delta_delay_thr_ms=30.0
dl_avg_owd_delta_max_adjust_down_thr_ms=60.0
ul_avg_owd_delta_max_adjust_down_thr_ms=60.0
shaper_rate_min_adjust_down_bufferbloat=0.95 # how rapidly to reduce shaper rate upon detection of bufferbloat (min reduction)
shaper_rate_max_adjust_down_bufferbloat=0.5 # how rapidly to reduce shaper rate upon detection of bufferbloat (max reduction)
reflectors=(
"1.1.1.1" "1.0.0.1" # Cloudflare
"8.8.8.8" "8.8.4.4" # Google
"9.9.9.9" "149.112.112.112" # QuadDNS
)
randomize_reflectors=1
no_pingers=10 # number of pingers to maintain
reflector_ping_interval_s=0.2 # (seconds, e.g. 0.2s or 2s)
bufferbloat_detection_window=12 # number of samples to retain in detection window
bufferbloat_detection_thr=4 # number of delayed samples for bufferbloat detection
pinger_binary=tsping

And i have installed and enabled the SQM .

But when i try to get it run i get this messages

"
root@GL-MT6000:~/cake-autorate# ./cake-autorate.sh
DEBUG; 2025-04-03-19:05:52; 1743699952.674028; Starting: rotate_log_file with PID: 17740
SYSLOG; 2025-04-03-19:05:52; 1743699952.678366; Starting cake-autorate with PID: 17740 and config: /root/cake-autorate/config.primary.sh
ERROR; 2025-04-03-19:05:52; 1743699952.684192; ping binary tsping does not exist. Exiting script.
DEBUG; 2025-04-03-19:05:52; 1743699952.687428; Starting: cleanup_and_killall with PID: 17740
INFO; 2025-04-03-19:05:52; 1743699952.688078; Stopping cake-autorate with PID: 17740 and config: /root/cake-autorate/config.primary.sh
INFO; 2025-04-03-19:05:52; 1743699952.688738; Killing all background processes and cleaning up temporary files.
root@GL-MT6000:~/cake-autorate# ERROR; 2025-04-03-19:05:52; 1743699952.690269; ./cake-autorate.sh: line 117: proc_pids['maintain_log_file']: unbound va riable

Please any help what i did wrong?
The normal SQM is working. I use PPPOE Fiber Internet with VLAN 32 with Cable.

thanks

Seems that you are trying to run with tsping but don’t have that installed.

So you should either install that (but I don’t think it’s available as a regular OpenWrt package yet) or switch to a different ping binary like fping (which is available as a regular OpenWrt package).

1 Like

Thanks for the Info. Oh i See but i dont know why... I have fping installed. Have i change an setting to use fping? Sorry for the question, but i'm really new to it.... Thanks for your help

In your config you have:

Just delete this line or substitute tsping with fping.

2 Likes

Perfect. Thanks. Now it´s running. But i get with Autorate higher results as without.
Maybe an Idea? With SQM most time i have in Waveform Test most time A unloaded 6 and DL Latency between 2 and +12, it´s very often change each test , Upload Latency 0. So upload seems to be OK. I adjust already the shaper rates...

In autorate config i have now only set shappers, nothing else. With Autorate running now i have A but higher Latency +16 and Unload 9. Is there some i can adjust to get it lower?

I have Fiber 500Mbit/200Mbit with Vlan 32 and use Ethernet. The Interface seems to be right
dl_if=ifb4pppoe-wan # download interface
ul_if=pppoe-wan # upload interface

Thanks

Yo be clear, cake-autorate is only suitable for variable rate connections. On fixed rate connections it can only worsen performance since it will always unnecessarily test to see if there has been a rate increase beyond the maximum available capacity.

So you mean i should only use SQM and no cake Autorate because my connection Speed is always the same? Means the autorate is only useful for mobil connections like 4G and Wifi?

Because i thinked autorate will adjust near the maximum i can get. I have in SQM higher Drops each tests, so it´s not the same each time. Sometimes A+ 6 and 2+ 0+, Sometimes much higher latency in Download. Without SQM the Latency is not so good with Fiber. Results higher than 20 or more and Grade B.

So cake-autorate is only designed for connections in which the maximum usable bandwidth varies for whatever reason. If your maximum available bandwidth is fixed you should simply set that value in your regular SQM setup.

2 Likes

Thanks so much for your Support! I will do that so, and i will adjust the SQM Settings to get the maximum performance and low Latency. Thanks!

2 Likes

One reason why a nominal fixed-rate link might profit from cake-autorate is transient overloads, say Friday evening primetime... there cake-autorate can still help, but it depends on the details. I think we had a few docsis/cable users that wanted autorate for that case.

2 Likes

i am now testing settings:

dl_avg_owd_delta_max_adjust_up_thr_ms=30.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_up_thr_ms=30.0 # (milliseconds)

dl_avg_owd_delta_max_adjust_down_thr_ms=90.0 # (milliseconds)
ul_avg_owd_delta_max_adjust_down_thr_ms=90.0 # (milliseconds)

i read that these are adjusted automatically, why should we change them?

dl_owd_delta_delay_thr_ms=30.0 # (milliseconds)
ul_owd_delta_delay_thr_ms=30.0 # (milliseconds)