Help with SQM/Bufferbloat

Hi all,

Just wondering if it's possible for anyone to give me a hand with configuring SQM to reduce bufferbloat if at all possible - I use a 4G connection - I know I'll not get A+ Ratings but Even if I can reduce it a bit would be great.

I used to use my phone and tether to an AR750, then my PC and I was able to get A ratings but since using the X750 I'm getting constantly D's or F's.

I'm a bit of a noob so laymans terms appreciated if possible - I'm trying to get the hang on the lingo but sometimes get lost pretty quickly.

Thanks :slight_smile:

1 Like

4G (actually all mobile data transfers) typically are variable rate, and sqm really only works well with fixed rate links. If your achievable rates are reasonably stable over a day, just set the SQM gross shaper rates to roughly the worst net speedtest result you get in the course of a day.
This same issue also affects 802.11 WiFi, but the Linux network stack has gained airtime fairness capabilities, which includes competent queue management to remedy this issue (to the degree possible), but 4G is different and unlikely to grow the same capabilities anytime soon.

I've tried capping it but still getting bad downstream bufferbloat/ ping spikes. Any idea why? Upstream seems to be ok, not sure if it's my config, router or my ISP.

You either encounter bursty RF transmissions or did not cap it aggressively enough. For the first I would just test with:
sudo mtr -ezb4 -i 0.5 8.8.8.8
for a few minutes with not much else going on, then llok at the worst case RTT to the end host in comparison to the best case RTT, if this shows spikes already there is really nothing sqm can do to remedy this, I fear...

root@GL-X750:~# sudo mtr -ezb4 -i 0.5 8.8.8.8
-ash: sudo: not found

This is what I'm getting back...?

Well, if you run it on the router you do not need sudo, as you are root already, so on the router just leave the sudo out, but if you run that command on a linux machine internal to your network you will need the sudo for the -i 0.5 part.
The openwrt ash shell tries to be helpful :wink:

still not working??

root@GL-X750:~# mtr -ezb4 -i 0.5 8.8.8.8
-ash: mtr: not found

what am i doing wrong?

image

I take it that's bad?

« SpeedGuide.net TCP Analyzer Results »
Tested on: 2020.09.10 12:26
IP address: 213.205.xxx.xxx
Client OS/browser: Windows 10 (Chrome 84.0.4147.135)

TCP options string: 020405520103030801010402
MSS: 1362
MTU: 1402
TCP Window: 262656 (not multiple of MSS)
RWIN Scaling: 8 bits (2^8=256)
Unscaled RWIN : 1026
Recommended RWINs: 65376, 130752, 261504, 523008, 1046016
BDP limit (200ms): 10506kbps (1313KBytes/s)
BDP limit (500ms): 4202kbps (525KBytes/s)
MTU Discovery: ON
TTL: 111
Timestamps: OFF
SACKs: ON
IP ToS: 00000000 (0)

This is some MTU test.
What's this about? Says my MTU isn't optimised, could that be causing an issue?

You are doing nothing wrong, as you probably noticed that is OpenWrt's shell way of telling that it does not know/find the command mtr.
You found a way aroundctgat great! Just for reference on the command line you can first use opkg update to have your router pull the package catalog and the opkg install mtr to install the package called mtr.

Looking at your results I first have a procedural recommendation, just copy and paste the text from the terminal window instead of making a screen copy and pasting an image to the forum. Please start such text patings with a line only containing three backticks ("```") and end them with another line only containing 3 backticks to ensure terminal compatible fixed font display.

And now to you results, the minimum latency seems okay, but worst and average indicate massive intermittent delays which will make interactive applications not much fun.

Mmmh, it really depends, I have no idea what kind of encapsulation your 4G ISP uses, so this might be enforced up you by your ISP.

Could you try the following:

ping -M do -c 1 -s 1464 1.1.1.1
ping -M do -c 1 -s 1465 1.1.1.1

ping -M do -c 1 -s 1374 1.1.1.1
ping -M do -c 1 -s 1375 1.1.1.1

This requires a proper ping binary (not sure the busybox ping sufices) and will test a few sizes without fragmentation, which should allow figuring out the internet MTU/MSS.

Start with these sizes, but really what I am interested in is to find the critical size
where it switches from working to not working:

PING 1.1.1.1 (1.1.1.1) 1465(1493) bytes of data.
ping: local error: Message too long, mtu=1492

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

root@turris:~# ping -M do -c 1 -s 1464 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1464(1492) bytes of data.
1472 bytes from 1.1.1.1: icmp_req=1 ttl=58 time=14.4 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 14.489/14.489/14.489/0.000 ms
root@turris:~# 

Here an example from my link, size 1464 works, but 1465 does not work without fragmentation, the question is what value do you see on your 4G link?

root@GL-X750:~# ping -M do -c 1 -s 1464 1.1.1.1
ping: unrecognized option: M
BusyBox v1.28.3 () multi-call binary.

Sorry I'm a bit of a noob at this stuff

Ah you need a more complete ping installed first. Try opkg update ; opkg install iputils-ping iputils-ping6 to install that and then repeat the test described above.

root@GL-X750:~# ping -M do -c 1 -s 1464 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1464(1492) bytes of data.
1472 bytes from 1.1.1.1: icmp_req=1 ttl=54 time=68.9 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 68.921/68.921/68.921/0.000 ms
root@GL-X750:~# ping -M do -c 1 -s 1465 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1465(1493) bytes of data.
1473 bytes from 1.1.1.1: icmp_req=1 ttl=54 time=60.3 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 60.325/60.325/60.325/0.000 ms
root@GL-X750:~# ping -M do -c 1 -s 1374 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1374(1402) bytes of data.
1382 bytes from 1.1.1.1: icmp_req=1 ttl=54 time=58.3 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 58.397/58.397/58.397/0.000 ms
root@GL-X750:~# ping -M do -c 1 -s 1375 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1375(1403) bytes of data.
1383 bytes from 1.1.1.1: icmp_req=1 ttl=54 time=51.9 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 51.964/51.964/51.964/0.000 ms

Thanks from that result I predict that
ping -M do -c 1 -s 1472 1.1.1.1
should still wotrk, while
ping -M do -c 1 -s 1473 1.1.1.1
probably fails (I might be off by one here though). That result unfortunately does not help as it indicates no additional encapsulation which we failed to account for so far....

root@GL-X750:~# ping -M do -c 1 -s 1472 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1472(1500) bytes of data.
1480 bytes from 1.1.1.1: icmp_req=1 ttl=54 time=48.8 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 48.860/48.860/48.860/0.000 ms
root@GL-X750:~# ping -M do -c 1 -s 1473 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 1473(1501) bytes of data.
ping: local error: Message too long, mtu=1500

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

Is there anything I can do at all to make it any better?

The only idea I have is to set the shaper rates really lower than the daily minimum you encounter, that way sqm will have a fighting chance of controlling the relevant buffers, otherwise you need an LTE modem/router with less in-built bufferbloat... BUT why don't you stay with the better performing AR750 + tethered phone instead?

The reason I no longer use the phone is because it kept connecting to two band 3 masts which gives me 20ms higher latency in fps gaming. Using the X750 allows me to CA to 7 & 3 which gives me lower latency.

I'd prefer to have the lower latency to be honest, this router isn't what I thought it would be,