CAKE w/ Adaptive Bandwidth [August 2022 to March 2024]

I'd say we should not pretend that it is an array, because this variable is used as a string. Remove the ().

1 Like

Remember that I filed anonymous third party observations back in December 2021?

@dlakelan's comment in another thread prompted me to check against EP3357189 and they've been picked up by the EPO Examiner and have made a difference.

Absent significant limitation this application will struggle:

For the full examination report, see the documents dated November 21, 2022 here.

1 Like

Oh, I just filled it with a string because I knew that would work,I have not tested filling it as an array, not my call to make.

BTW, I could/did not test the meat of the new feature ping_prefix_string at all, since I do not use mwan3 and I did not come up with a reasonable thing to wrap around ping/fping, so if you would find tie to do so that would be great.

Yeah I should remove the () there. Don't know why I put that originally and in the new prefix string just use "".

BTW @patrakov how does the form you identified above:

X=(path*)

work in bash? I get the use of the array there, but didn't realise paths/completion could be used like that.

Use "nice" as an example prefix which does nothing really but can be inspected in top as changed priority.

path* is an unquoted string, so it undergoes glob expansion, yielding multiple tokens. () is something that constructs an array from these tokens.

1 Like

cake-autprate_config.sh

ping_prefix_string="nice"                                                                                                                                                                                          

htop:

  PID+USER       PRI  NI  VIRT   RES   SHR S  CPU% MEM%   TIME+  Command                                                                                                                                           
24808 root        30  10  1792   520   492 S   0.0  0.1  0:00.17 |           `+ fping --timestamp --loop --period 500 --interval 50 --timeout 10000 94.140.14.15 8.8.4.4 1.0.0.1 94.140.15.16 1.1.1.1 208.67.220.12

Yepp, does do what we expect, increases the NI value by 10 over the default.

1 Like

Mmmh trying to pre-append nice with iputils ping fails:

DEBUG; 2022-12-01-23:01:55; 1669932115.533003; Pausing reflector health check.
LOAD; 2022-12-01-23:01:55; 1669932115.679239; 1669932115.678862; 9; 11
ping: unrecognized option: D
BusyBox v1.33.2 (2022-10-19 16:21:10 UTC) multi-call binary.

Usage: ping [OPTIONS] HOST

Send ICMP ECHO_REQUESTs to HOST

        -4,-6           Force IP or IPv6 name resolution
        -c CNT          Send only CNT pings
        -s SIZE         Send SIZE data bytes in packets (default 56)
        -i SECS         Interval
        -A              Ping as soon as reply is recevied
        -t TTL          Set TTL
        -I IFACE/IP     Source interface or IP address
        -W SEC          Seconds to wait for the first response (default 10)
                        (after all -c CNT packets are sent)
        -w SEC          Seconds until ping exits (default:infinite)
                        (can exit earlier with -c CNT)
        -q              Quiet, only display output at start/finish
        -p HEXBYTE      Payload pattern
LOAD; 2022-12-01-23:01:55; 1669932115.879727; 1669932115.879343; 28; 20
DEBUG; 2022-12-01-23:01:56; 1669932116.035080; Connection stall ended. Resuming normal operation.
DEBUG; 2022-12-01-23:01:56; 1669932116.035546; Resuming reflector health check.
LOAD; 2022-12-01-23:01:56; 1669932116.080078; 1669932116.079705; 8; 3
LOAD; 2022-12-01-23:01:56; 1669932116.280515; 1669932116.280139; 13; 14
DEBUG; 2022-12-01-23:01:56; 1669932116.286438; Warning: no reflector response within: 0.250000 seconds. Checking for loads.
DEBUG; 2022-12-01-23:01:56; 1669932116.287592; load check is: ((13 kbps > 10 kbps && 14 kbps > 10 kbps))
DEBUG; 2022-12-01-23:01:56; 1669932116.288082; load above connection stall threshold so resuming normal operation.
ping: unrecognized option: D
BusyBox v1.33.2 (2022-10-19 16:21:10 UTC) multi-call binary.

Usage: ping [OPTIONS] HOST

Send ICMP ECHO_REQUESTs to HOST

        -4,-6           Force IP or IPv6 name resolution
        -c CNT          Send only CNT pings
        -s SIZE         Send SIZE data bytes in packets (default 56)
        -i SECS         Interval
        -A              Ping as soon as reply is recevied
        -t TTL          Set TTL
        -I IFACE/IP     Source interface or IP address
        -W SEC          Seconds to wait for the first response (default 10)
                        (after all -c CNT packets are sent)
        -w SEC          Seconds until ping exits (default:infinite)
                        (can exit earlier with -c CNT)
        -q              Quiet, only display output at start/finish
        -p HEXBYTE      Payload pattern
LOAD; 2022-12-01-23:01:56; 1669932116.481006; 1669932116.480586; 0; 0
DEBUG; 2022-12-01-23:01:56; 1669932116.538919; Warning: no reflector response within: 0.250000 seconds. Checking for loads.
DEBUG; 2022-12-01-23:01:56; 1669932116.540023; load check is: ((0 kbps > 10 kbps && 0 kbps > 10 kbps))
DEBUG; 2022-12-01-23:01:56; 1669932116.540557; Warning: connection stall detection. Waiting for new ping or increased load

somehow it picks busybox' ping instead

Probably because "nice" defaults to busybox' nice...

Nice find! Why does pretending busybox nice result in the subsequent ping call giving busybox ping?

Should we change anything to compensate?

These cutdown busybox utilities seem to me like a pain in the ass. Do they make any sense for OpenWrt routers with a reasonable specification or is the gain truly minimal?

1 Like

I see what you did there :wink:

Yes they make a ton of sense as they are reducing the size quite a lot, so for anything with 8-16 MB storage every byte counts and needs to pull its own weight, so if a busybox version of a tool suffices that helps save valuable space.

Yepp, after:

opkg update ; opkg install coreutils-nice

I see now:

  PID+USER       PRI  NI  VIRT   RES   SHR S  CPU% MEM%   TIME+  Command                                                                                                                                           
21067 root        20   0  1608  1244   916 S   0.0  0.1 21:09.81 `- SCREEN -RR autorate
21068 root        20   0  1232   836   792 S   0.0  0.1  0:00.02 |  `- /bin/ash
27198 root        20   0  2444  2124  1584 S   5.8  0.2  0:01.91 |     `- /bin/bash ./cake-autorate.sh
27202 root        20   0  2388  1664  1180 S   1.0  0.2  0:00.35 |        `- /bin/bash ./cake-autorate.sh
27211 root        20   0  2408  1368   868 S   1.0  0.1  0:00.30 |        `- /bin/bash ./cake-autorate.sh
27212 root        20   0  2448  1720  1180 S   1.0  0.2  0:00.18 |        `- /bin/bash ./cake-autorate.sh
27214 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 156.154.71.2
27215 root        20   0  2468  1556  1020 S   0.0  0.2  0:00.08 |           `- /bin/bash ./cake-autorate.sh
27217 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 156.154.70.1
27218 root        20   0  2468  1560  1020 S   1.0  0.2  0:00.08 |           `- /bin/bash ./cake-autorate.sh
27220 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 8.8.8.8
27221 root        20   0  2472  1560  1020 S   0.0  0.2  0:00.07 |           `- /bin/bash ./cake-autorate.sh
27223 root        30  10   784   540   508 S   0.0  0.1  0:00.00 |           `- ping -D -i 0.5 208.67.220.2
27224 root        20   0  2468  1560  1020 S   0.0  0.2  0:00.07 |           `- /bin/bash ./cake-autorate.sh
27226 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 9.9.9.10
27227 root        20   0  2472  1560  1020 S   0.0  0.2  0:00.08 |           `- /bin/bash ./cake-autorate.sh
27229 root        30  10   784   540   508 S   0.0  0.1  0:00.02 |           `- ping -D -i 0.5 94.140.14.141
27230 root        20   0  2468  1560  1020 S   0.0  0.2  0:00.08 |           `- /bin/bash ./cake-autorate.sh
27232 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 8.8.4.4
27233 root        20   0  2468  1560  1020 S   1.0  0.2  0:00.07 |           `- /bin/bash ./cake-autorate.sh
27235 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 185.228.169.11
27236 root        20   0  2468  1560  1020 S   0.0  0.2  0:00.06 |           `- /bin/bash ./cake-autorate.sh
27238 root        30  10   784   540   508 S   0.0  0.1  0:00.01 |           `- ping -D -i 0.5 9.9.9.9
27239 root        20   0  2472  1560  1020 S   1.0  0.2  0:00.07 |           `- /bin/bash ./cake-autorate.sh
27241 root        30  10   784   476   444 S   0.0  0.0  0:00.00 |           `- ping -D -i 0.5 208.67.220.220
27242 root        20   0  2468  1560  1020 S   1.0  0.2  0:00.07 |           `- /bin/bash ./cake-autorate.sh   

so ping_prefix_string also works with iputils-ping, as expected.

Now the only question is, does this also work for mwan3, but I am pretty confident it will...

1 Like

Hello to all I come back to you concerning autorate and starlink

firstly during the speed test it only took into account the minimum speed that I had put

for example 100000
150000
180000

it was always based from 100000 for my download and 5000 on my upload

2ndly impossible to get upnp or nat open via port forward (but this has nothing to do with autorate)

3rdmebt during a direct wifi connection to starlink the beginning of its games usually started at 42 ms then find a game at 60 or 80 ms (lobby)

with the router not start before 95 ms then finished at 200ms (unplayable game, lag was permanent without exaggerating from seconds to seconds)

how make reduce ping with starlink is possible with a router you thinked

or i has make an error ?

min_dl_shaper_rate_kbps=100000  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=150000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=200000  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=5000  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=6000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=8000  # maximum bandwidth for upload (Kbit/s)

thanks for your help
Translated with www.DeepL.com/Translator (free version)

Ah yes been reading about multi-call binary. Seems pretty cool then. I just wondered if more modern routers had enough memory that it didn't make so much sense anymore but seems not the case.

Maybe the full path can be set for the ping binary?

1 Like

Let's just ignore the issue, pre-appending nice was only intended to allow me to test the new feature, I see little use of that for a 'production' autorate instance. If this does not trigger with @patrakov's mwan3 invocation we can just make a note in the config file and be done with, no?

1 Like

Now, I don't know exactly, but I doubt that starlink will actually reliably deliver download rates in excess of 100000. If the true rate drops below that, autorate will not do anything for you anymore, so I would recommend you try to take a set of speedtests over the course of a day and figure out what the lowest speed is you see and then decide what to put in the minimum rate. Remember the minimum rates really describe something to autorate like "below this rate I value throughput way over responsiveness, and will accept all bufferbloat only to not wate potential throughput".

Could you describe that a bit more explicitly, please?

Hard to tell, never tried starlink myself, starlink seems to have some periodic latency spikes, but whether these are show-stoppers for gaming or not I can not tell (as in addition not having starlink, I also stopped playing reaction time gated games somewhen after original quake came out, and never as online multiplayer game*).

My gut feeling is that at least the min and base are set way too high, but I have no data to back this up. The speed tests you posted are not out of line with your numbers, (except for the minimum rate for the upload, the waveform test with the C rating had considerably less than 5000 Kbps upload goodput).

*) Easy to forego if one sucks at that kind of game :wink:

1 Like

hère my screen his started min 90ms with starlink and router with starlink only

for example at my home i started before

I agree with @moeller0 that setting the minimum bandwidth to 100 Mbit/s is likely far too high.

@gba configured cake-autorate for his Starlink as follows:

min_dl_shaper_rate_kbps=10000  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=50000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=200000  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=2000  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=10000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=30000  # maximum bandwidth for upload (Kbit/s)

And with:

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

And with:

# delay threshold in ms is the extent of RTT increase to classify as a delay
# this is automatically adjusted based on maximum on the wire packet size
# (adjustment significant at sub 12Mbit/s rates, else negligible)  
delay_thr_ms=75 # (milliseconds)

And with:

# rate adjustment parameters 
# bufferbloat adjustment works with the lower of the adjusted achieved rate and adjusted shaper rate
# to exploit that transfer rates during bufferbloat provide an indication of line capacity
# otherwise shaper rate is adjusted up on load high, and down on load idle or low
# and held the same on load medium
achieved_rate_adjust_down_bufferbloat=0.85 # how rapidly to reduce achieved rate upon detection of bufferbloat 
shaper_rate_adjust_down_bufferbloat=0.85   # how rapidly to reduce shaper rate upon detection of bufferbloat 
shaper_rate_adjust_up_load_high=1.02       # how rapidly to increase shaper rate upon high load detected 
shaper_rate_adjust_down_load_low=0.8       # how rapidly to return down to base shaper rate upon idle or low load detected 
shaper_rate_adjust_up_load_low=1.01        # how rapidly to return up to base shaper rate upon idle or low load detected 

And with:

# bufferbloat is detected when (bufferbloat_detection_thr) samples
# out of the last (bufferbloat detection window) samples are delayed
bufferbloat_detection_window=6  # number of samples to retain in detection window
bufferbloat_detection_thr=2     # number of delayed samples for bufferbloat detection

You should also set:

# Starlink satellite switch (sss) compensation options
sss_compensation=1 # enable (1) or disable (0) Starlink handling

So you could alter the defaults in the config.sh file based on:

(but don't use the above config - it won't work).

Perhaps if any other Starlink readers are reading this then they could chip in.

@moeller0 I found another source of reflectors (NordVPN servers) and even an API we can use to obtain good reflectors all over the world:

e.g. see:

curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output |grep -e "hostname" -e '"station"'
    "station": "94.46.222.147",
    "hostname": "uk2373.nordvpn.com",
    "station": "217.146.92.182",
    "hostname": "uk2259.nordvpn.com",
    "station": "194.35.233.107",
    "hostname": "uk2112.nordvpn.com",
    "station": "194.35.233.229",
    "hostname": "uk1812.nordvpn.com",
    "station": "109.70.150.89",
    "hostname": "uk2328.nordvpn.com",
    "station": "78.157.193.51",
    "hostname": "uk1912.nordvpn.com",
    "station": "178.159.3.182",
    "hostname": "uk2203.nordvpn.com",
    "station": "89.35.30.223",

Here are some for Germany:

curl --silent "https://api.nordvpn.com/v1/servers/recommendations?filters\[country_id\]=81&limit=10" | jq --raw-output |grep '"ip": "'
          "ip": "5.180.62.30",
          "ip": "146.70.62.227",
          "ip": "5.180.62.181",
          "ip": "5.180.62.129",
          "ip": "37.120.197.43",
          "ip": "89.249.65.67",
          "ip": "89.249.65.99",
          "ip": "5.253.115.2",
          "ip": "5.180.62.108",
          "ip": "185.196.22.208",

And we can get their loads:

curl --silent "https://api.nordvpn.com/v1/servers/recommendations" | jq --raw-output 'limit(3;.[]) | "  Server: \(.name)\nHostname: \(.hostname)\nLocation: \(.locations[0].country.name) - \(.locations[0].country.city.name)\n    Load: \(.load)\n"'
  Server: United Kingdom #2311
Hostname: uk2311.nordvpn.com
Location: United Kingdom - London
    Load: 11

  Server: United Kingdom #2077
Hostname: uk2077.nordvpn.com
Location: United Kingdom - London
    Load: 11

  Server: United Kingdom #2150
Hostname: uk2150.nordvpn.com
Location: United Kingdom - London
    Load: 12

But they may not respond to ICMP type 13 it seems.

That is NPING fooling us:
orig=51205000 recv=0 trans=0 means that the remote end did not send us the expected timestamps.
HPING3 returns a clearer result:

laptop:~ user$ sudo hping3 194.35.233.104 --icmp --icmp-ts -c 1
HPING 194.35.233.104 (en4 194.35.233.104): icmp mode set, 28 headers + 0 data bytes

--- 194.35.233.104 hping statistic ---
1 packets tramitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms

Here an example that does respond:

laptop:~ user$ sudo hping3 62.109.121.1 --icmp --icmp-ts -c 1
HPING 62.109.121.1 (en4 62.109.121.1): icmp mode set, 28 headers + 0 data bytes
len=46 ip=62.109.121.1 ttl=56 id=21356 icmp_seq=0 rtt=7.8 ms
ICMP timestamp: Originate=51759154 Receive=51759238 Transmit=51759238
ICMP timestamp RTT tsrtt=8


--- 62.109.121.1 hping statistic ---
1 packets tramitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 7.8/7.8/7.8 ms

Ah you found out already.... :wink: