CAKE w/ Adaptive Bandwidth

These are the specs of my 5g modem and network stats:

These are also the stats I have:
Screenshot 2024-09-28 110706

HTOP while running speedtest with cake-autorate:

HTOP while running speed test with cake-autorate and running this code: ping -n 1000 1.1.1.1

1 Like

Really nice setup!

What’s the package to get the LTE signal stats reported in LuCi I wonder?

The data mostly shows a quiet network, but it’s much more interesting to see the same for when your connection is saturated for a good length of time. Could you repeat the tests under such conditions?

Also maybe you could upload the data file using:

By the way, which version of cake-autorate are you using? I’d recommend using the latest version on the ‘master’ branch if you aren’t already.

Can you check that you enabled the "Detailed CPU time" option in htop's display options sub menu, please? Otherwise the bar display does not show soft interrupt context, but that is where cake uses most CPU cycles...

P.S.: I remember that I promised to look at integrating the per-CPU data into the octave output, but I am just resurfacing from a bunch of deadlines, so this will still take a bit

Hello @Lynx

Thank you! I got this fork firmware for AW1000 from xHikari :slight_smile: I think its 3ginfo-lite as that is showing on my luci page.

The data mostly shows a quiet network, but it’s much more interesting to see the same for when your connection is saturated for a good length of time. Could you repeat the tests under such conditions?

I see. No problem! I'll try to do that this coming week as Im going back to my place where my 5g modem is primary connection.

Also maybe you could upload the data file using:

Sure here's the link

By the way, which version of cake-autorate are you using? I’d recommend using the latest version on the ‘master’ branch if you aren’t already.

I just checked mine and it says 3.3.0 pre-release.

Hi @moeller0 sure no problem here are the two screenshot I took earlier.

This one has a running -f pings which I forgot to kill :sweat_smile:

Heres another one while playing two 4k videos on youtube and playing mobile games and doing speed test on another computer.

let me know if these are what you're looking for :slight_smile:

Hello, I'm having reflector issues atm I'm not sure what might be the cause of this. I was adjusting my reflectors and deleted quite a lot due to latency issues I'm having with them:

#!/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=ifb4wwan0 # download interface
ul_if=wwan0     # upload interface

# 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=90000  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=185000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=280000  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=14000  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=28000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=42000  # 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.


# Faster speed increase sensitivity
dl_avg_owd_delta_max_adjust_up_thr_ms=10.0
ul_avg_owd_delta_max_adjust_up_thr_ms=10.0

# Less strict on latency before restricting speeds
dl_owd_delta_delay_thr_ms=20.0
ul_owd_delta_delay_thr_ms=20.0

# Less sensitive to buffer issues
dl_avg_owd_delta_max_adjust_down_thr_ms=40.0
ul_avg_owd_delta_max_adjust_down_thr_ms=40.0

reflectors=(
"223.5.5.5" "223.6.6.6"  # AliDNS
"1.1.1.1" "1.0.0.1"  # Cloudflare
"8.8.8.8" "8.8.4.4"  # Google
)

randomize_reflectors=1

pinger_binary=tsping
DEBUG; 2024-10-01-17:31:08; 1727775068.440215; Starting: change_state_main with PID: 16108
DEBUG; 2024-10-01-17:31:08; 1727775068.440687; Changing main state from: STALL to: RUNNING
LOAD; 2024-10-01-17:31:08; 1727775068.639543; 1727775068.639384; 7; 27; 185000; 28000
DEBUG; 2024-10-01-17:31:08; 1727775068.640245; Warning: no reflector response within: 250000.0 seconds. Checking loads.
DEBUG; 2024-10-01-17:31:08; 1727775068.640667; load check is: (( 7 kbps > 10 kbps for download && 27 kbps > 10 kbps for upload ))
DEBUG; 2024-10-01-17:31:08; 1727775068.641084; Starting: change_state_main with PID: 16108
DEBUG; 2024-10-01-17:31:08; 1727775068.641442; Changing main state from: RUNNING to: STALL
DEBUG; 2024-10-01-17:31:08; 1727775068.642062; no ping response from reflector: 1.1.1.1 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.642526; reflector=1.1.1.1, sum_reflector_offences=1 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.643077; no ping response from reflector: 1.0.0.1 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.643457; reflector=1.0.0.1, sum_reflector_offences=3 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.643814; Warning: reflector: 1.0.0.1 seems to be misbehaving.
DEBUG; 2024-10-01-17:31:08; 1727775068.644248; Starting: replace_pinger_reflector with PID: 16108
DEBUG; 2024-10-01-17:31:08; 1727775068.644641; No additional reflectors specified so just retaining: 1.0.0.1.
DEBUG; 2024-10-01-17:31:08; 1727775068.644990; Resetting reflector offences associated with reflector: 1.0.0.1.
DEBUG; 2024-10-01-17:31:08; 1727775068.646987; no ping response from reflector: 223.6.6.6 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.647373; reflector=223.6.6.6, sum_reflector_offences=2 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.647937; no ping response from reflector: 8.8.8.8 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.648344; reflector=8.8.8.8, sum_reflector_offences=60 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.648713; Warning: reflector: 8.8.8.8 seems to be misbehaving.
DEBUG; 2024-10-01-17:31:08; 1727775068.649150; Warning: skipping replacement of reflector: 8.8.8.8 given prior replacement within this reflector health check cycle.
DEBUG; 2024-10-01-17:31:08; 1727775068.649754; no ping response from reflector: 223.5.5.5 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.650161; reflector=223.5.5.5, sum_reflector_offences=60 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.650532; Warning: reflector: 223.5.5.5 seems to be misbehaving.
DEBUG; 2024-10-01-17:31:08; 1727775068.650885; Warning: skipping replacement of reflector: 223.5.5.5 given prior replacement within this reflector health check cycle.
DEBUG; 2024-10-01-17:31:08; 1727775068.651451; no ping response from reflector: 8.8.4.4 within reflector_response_deadline: 1.0s
DEBUG; 2024-10-01-17:31:08; 1727775068.651855; reflector=8.8.4.4, sum_reflector_offences=60 and reflector_misbehaving_detection_thr=3
DEBUG; 2024-10-01-17:31:08; 1727775068.652213; Warning: reflector: 8.8.4.4 seems to be misbehaving.
DEBUG; 2024-10-01-17:31:08; 1727775068.652569; Warning: skipping replacement of reflector: 8.8.4.4 given prior replacement within this reflector health check cycle.
LOAD; 2024-10-01-17:31:08; 1727775068.840717; 1727775068.840560; 0; 7; 185000; 28000
LOAD; 2024-10-01-17:31:09; 1727775069.041879; 1727775069.041719; 2; 11; 185000; 28000
LOAD; 2024-10-01-17:31:09; 1727775069.243040; 1727775069.242886; 0; 49; 185000; 28000
LOAD; 2024-10-01-17:31:09; 1727775069.444196; 1727775069.444041; 2; 7; 185000; 28000
LOAD; 2024-10-01-17:31:09; 1727775069.645342; 1727775069.645186; 4; 7; 185000; 28000
LOAD; 2024-10-01-17:31:09; 1727775069.846511; 1727775069.846355; 0; 7; 185000; 28000
LOAD; 2024-10-01-17:31:10; 1727775070.047668; 1727775070.047512; 0; 30; 185000; 28000

I cant seem to do this command also when I do it just hang tail -f /var/log/cake-autorate.primary.log | grep -e SUMMARY

Furthermore, I was back reading earlier and found that enabling ack would help on upload speed especially with asymmetrical connection hence I also added this on my sqm config file.

root@HikariWrt:~# cat /etc/config/sqm

config queue 'eth1'
        option enabled '1'
        option interface 'wwan0'
        option download '5000'
        option upload '5000'
        option qdisc 'cake'
        option script 'layer_cake.qos'
        option linklayer 'none'
        option debug_logging '0'
        option verbosity '5'
        option qdisc_advanced '1'
        option squash_dscp '1'
        option squash_ingress '1'
        option ingress_ecn 'ECN'
        option egress_ecn 'ECN'
        option qdisc_really_really_advanced '1'
        option eqdisc_opts 'nat dual-srchost ack-filter memlimit 32mb'

You might want to verify you get good responses to the reflectors of your choice by independently testing them from a terminal.

Can you upload full log file(s) by running through gzip and uploading via:

Not sure if ack-filter in your case with your huge bandwidths is necessary, but @moeller0 could better advise than I on that front.

Hello Lynx! Apparently when paired with tsping my pings are not being received except with quaddns. I changed it back to fping I think dns servers are limiting icmp like tsping when pinging as I understood it.

Its working well now with fping as of now. The gzip file is here: link

No password.

Not sure if ack-filter in your case with your huge bandwidths is necessary, but @moeller0 could better advise than I on that front.

I see. No problem I’m just testing it out right now as it might help with getting higher upload as I upload a lot photos. :slight_smile:

Yes for tsping ICMP timestamps you likely need to curate and select different reflectors...

1 Like

Feel free to stick with tsping (theoretically it's superior), but just make sure to use reflectors that support timestamp ICMPs like 9.9.9.9, etc.

To identify reflectors that support timestamp ICMP type 13 pings, see @tievolu's lists here:

2 Likes

Thank you so much @Lynx and @moeller0 I’ll go ahead and curate my reflectors. I’ve been looking for lists of dns since yesterday. Once again thank your tagging it here. I appreciate both of your help always!

1 Like

Good. And once you've got it up and running please share data from a few speed tests and we can analyse the data and figure out any further optimisation.

I can't believe it's been two years since I created those lists! I really need to run my scripts again to update them.

That said, I'm still using the UK list from that repo and it works ok. I run my perl sqm-autorate implementation with the full UK list of several thousand reflectors and let the script sort out which ones are reliable. More than enough of them still work sufficiently well for this approach to work just fine.

EDIT: I updated the reflector lists today :+1:

1 Like

I am struck by this fact too. It seems that our perception of time is such that time passes by faster as we get older. Life is fleeting, and so we should try to prioritise and act upon that which truly matters.

Hello @Lynx Good afternoon I'm scratching my head since this morning why my latency on download keeps spiking to 400-500ms on waveform while my upload speed is between 0-10ms only.

Here are the png files plotted I think quaddns is being problematic on my end I think? I've run 3 instances of speed tests during these graphs.



Here's my updated config file too I didnt change much on the lists of dns right now as I'm having issues with the reflectors I choose within my country. Note that I reduced number of pingers to 4 and ping intervals to 0.2s on this:

#!/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=ifb4wwan0 # download interface
ul_if=wwan0     # upload interface

# 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=50000  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=100000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=200000  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=14000  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=28000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=42000  # 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.


# Faster speed increase sensitivity
dl_avg_owd_delta_max_adjust_up_thr_ms=10.0
ul_avg_owd_delta_max_adjust_up_thr_ms=10.0

# Less strict on latency before restricting speeds
dl_owd_delta_delay_thr_ms=20.0
ul_owd_delta_delay_thr_ms=20.0

# Less sensitive to buffer issues
dl_avg_owd_delta_max_adjust_down_thr_ms=40.0
ul_avg_owd_delta_max_adjust_down_thr_ms=40.0

reflectors=(
"223.5.5.5" "223.6.6.6"  # AliDNS
"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=4 # number of pingers to maintain

reflector_ping_interval_s=0.2 # (seconds, e.g. 0.2s or 2s)

pinger_binary=tsping

This the log file as well if you'd like to take a look: link

No password.

Thank you!

So with tsping you see that latency increase during uploads is bigger than during downloads (maybe you want to try different thresholds for UL and DL?) but achievable rate seems more consistent for the upload direction (but it is also considerably smaller than download so easier to saturate).

I would try to add more candidates to the list, the octave plots imply only two of your reflectors contributed latency data, and that gives only limited reflector diversity. (Reducing the number of pingers to 4 might be fine I just recommend to increase the pool size from which to pick reflectors, as cake-autorate will try to prune out unsuitable reflectors, which in your case seems to have jettisoned two of the 4 you specified, which is sub-optimal).

Hi @moeller0 During waveform buffer bloat testing and speedtest I’m seeing huge latency when download speed is actively being done. Also yes, I’m getting better result on upload speed.

I’m also curious as to why my download speed is hovering between my min dl shaper rate to nearing close to my baseline but rarely going beyond that.

I would try to add more candidates to the list, the octave plots imply only two of your reflectors contributed latency data, and that gives only limited reflector diversity. (Reducing the number of pingers to 4 might be fine I just recommend to increase the pool size from which to pick reflectors, as cake-autorate will try to prune out unsuitable reflectors, which in your case seems to have jettisoned two of the 4 you specified, which is sub-optimal).

I’ll go ahead and add more reflectors it seems to be the lists from @tievolu is working again. I’ll monitor my connection again. Thank you again!

Because to do so cake-autorate would likely need to exceed your latency thresholds...

1 Like

From your graph above I see noticeable latency spikes for both upload and download tests...

I hope that this will not only please my sensitivities, but will also result in a more robust and reliable control loop for your link.

1 Like

I see thank you so much! I’ve been using lynx recommended settings atm. I’ll go check other optimization I can do on my end.

From your graph above I see noticeable latency spikes for both upload and download tests...

Im thinking perhaps an external antenna will help in my area. But my sinr is hovering around 15-20db.

I hope that this will not only please my sensitivities, but will also result in a more robust and reliable controll loop for your link.

You’ve done so much on making my network better and @Lynx too. I’m quite embarrassed not to contribute much on this thread but thank you again!