Running two SQMs on two separate devices... is this common?

I have a RPi4 as my primary router and another device as an AP. I am running SQM on the router but noticed when running some bufferbloat tests that although wired devices score well, wireless devices do not. I have since setup SQM as well on the AP shaping the interface on which wireless devices are on and am getting much better numbers for bufferbloat there as well. Is this normal? If bufferbloat is being introduced by my ISP, and if my router is shaping the traffic to minimize it, why do my wireless clients need the 2nd SQM running in order to scope well?

This sounds like your WiFi is bloated, and by using a shaper on the AP you avoid overfilling the oversized but undermanaged buffers. This situation happens once the wan link gets faster than the speed your AP reliably offers over its wireless. Some wireless adaptets lile ath9K and ath10K and IIRC mt76, had some effort put into them for keeping latency under load in check, but others have not.

The WAN side is gigabit backbone, so I think it fits into your description. I guess it's normal to have two SQMs from what you're saying. Thanks for the context.

Well, that or a properly debloated WiFi stack ;). Just as an information, WiFi aggregation can easily introduce an additional >= 4ms jitter to your end-2-end latencies, even with a de-bloated WiFi stack, but that is because WiFi has a relative large per transmit-event overhead and the one way to ameliorate that is to use fewer transmits and stuff more packets into these, and to fill 4ms airtime the WiFi stacks needs >= 4ms deep buffers (better stacks use the current estimate of the transmit rates to figure out how much data fits into an aggregate IIRC).
The problem with SQM to fix up WiFi is, that it does not work too well. SQM expects reliable transmission rates, and if faces with variable speed links like WiFi all you can do is to shaoe down to the minimum you consider likely (but then, move one station further away from the AP, et viola your shaper will be set too high to control bufferbloat). That said, for reasonable stable wifi environments it will still help most of the time.
(Personally, I would look to get my AP up to speed with the latest WiFi goodness, like airtime fairness and airtime queuing limits, as these promose to keep WiFi latency low without requiring a fixed traffic shaper).

I don't recall doing anything with airtime fairness nor airtime queuing limits. Link or suggested place to start learning?

Not much here: https://openwrt.org/docs/guide-user/network/wifi/basic

This is a bit old, but still has useful pointers:
https://www.bufferbloat.net/projects/make-wifi-fast/wiki/

I saw the academic stuff (didn't understand most of it) but am wondering what to do with a modern build of openwrt.

I guess the first questipn is, what wifi drivers/hardware are you using... if ath9k, ath10, or mt76 there is a decent chance that you can profit from Toke and Dave's work, either already today or once a sufficiently modernbkernel is adopted by OpenWrt, for all others including ath11k all bets are off....
What AP hardware are you using, and what level of bufferbloat did you encounter?

The AP is a netgear R7800 which uses ath10. The level of buffer bloat is variable but usually unloaded is 20-30ms, downloading is 300-400 ms, and uploading is 50-100 ms.

What exactly needs to be adjusted? Where are the tunables and how does one go about doing it?

Have a look at https://forum.openwrt.org/t/aql-and-the-ath10k-is-lovely/59002. This should get you started.

1 Like

Thanks, lots to unpack there. I seem to have AQL on this R7800:

 cat /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/*/aql
Q depth: VO: 0 us VI: 0 us BE: 0 us BK: 0 us
Q limit[low/high]: VO: 5000/12000 VI: 5000/12000 BE: 5000/12000 BK: 5000/12000

Still reading through the 300+ posts but not sure how to what to tune to adjsut.