[Bloat] CPU consumption using TC-TBF and TC-POLICE to limit rate

Jonathan Morton chromatix99 at gmail.com
Tue May 26 08:50:18 EDT 2020


> On 26 May, 2020, at 12:47 pm, Jose Blanquicet <blanquicet at gmail.com> wrote:
> 
> We have an embedded system with limited CPU resources that acts as
> gateway to provide Internet access from LTE to a private Wi-Fi
> network. Our problem is that the bandwidth on LTE and Wi-Fi links is
> higher than what the system is able to handle thus it reaches 100% of
> CPU load when we perform a simple speed test from a device connected
> to our Wi-Fi Hotspot.
> 
> Therefore, we want to limit the bandwidth to avoid system gets
> saturated is such use-case. To do so, we thought to use the QDISC-TBF
> on the Wi-Fi interface. For instance, to have 10Mbps:
> 
>    tc qdisc add dev wlan0 root tbf rate 10mbit burst 12500b latency 50ms
> 
> It worked correctly and maximum rate was limited to 10Mbps. However,
> we noticed that the CPU load added by the TBF was not negligible for
> our system.

Just how limited is the CPU on this device?  I have successfully shaped at several tens of Mbps on a Pentium-MMX, where the limiting factor may have been the PCI bus rather than the CPU itself.

Assuming your CPU is of that order of capability, I would suggest installing Cake using the out-of-tree build process, and the latest stable version of the iproute2 tools to configure it.  Start with:

	git clone https://github.com/dtaht/sch_cake.git

This provides a more efficient and more effective shaper than TBF, and a more effective AQM than a policer, and good flow-isolation properties, all in a single bundle that will be more efficient than running two separate components.

Once installed, the following should set it up nicely for you:

	tc qdisc replace dev wlan0 root cake bandwidth 10Mbit besteffort flows ack-filter

Cake is considered quite a heavyweight solution, but very effective.  If it doesn't work well for this particular use case, it may be feasible to backport some more recent work which takes a simpler approach, though along similar lines.

 - Jonathan Morton



More information about the Bloat mailing list