The OpenWrt Project is a Linux operating system targeting embedded devices. A common use of OpenWrt is to replace the manufacturer's firmware on a commercial, off-the-shelf router to produce a device with performance, features and security not available from the original vendor.
In addition, OpenWrt has been used as a research platform to investigate (and solve) the problem of bufferbloat: the undesirable latency that comes from a router or other network equipment buffering too much data. The first real solution came in 2012 with the introduction of the fq_codel queue discipline that made a "no knobs" way to eliminate bufferbloat. The CAKE algorithm (created in 2015, merged into OpenWrt in 2018) provided even better performance. These techniques have since been applied to Wi-Fi to decrease buffering delays by an order of magnitude (typically, down to 10-100 msec) from earlier drivers.
Bufferbloat occurs at a bottleneck — when fast links hit a slower link. This happens in a home router when Ethernet traffic reaches the slower ISP link, or when a fast laptop hits a slower Wi-Fi link. A router will queue up the data, to be doled out as it can. In a bad router, all the traffic goes into one queue, imposing a delay on the big flow as well as all other traffic. This is bufferbloat, and can reach several seconds, making the entire network "feel slow".
About Smart Queue Management (SQM)
OpenWrt minimizes bufferbloat using either the fq_codel or CAKE "Smart Queue Management" algorithms. These introduce a bottleneck queue within the router itself, generally, about 5% slower than the ISP link. This means that the traffic builds up in the SQM queues where they can be controlled.
Both algorithms work by separating all traffic flows into their own queues: this isolates low traffic flows from the high volume flows. SQM then round-robins between the queues, sequentially removing a "fair" portion of data from each queue and transmitting it. A large flow can't monopolize the bottleneck link, but will use the full capacity when there's no other traffic.
On ISP Connections
OpenWrt supports SQM to control all the traffic flowing through the ISP bottleneck connection to provide fairness to all flows, and minimize the latency for all packets sent through the link.
-
What devices support this? All modern versions of OpenWrt support both CAKE and fq_codel from the Network -> SQM QoS settings. (You may need to install
luci-app-sqm
first.) -
How do I configure it? You'll need to enter download and upload settings into SQM. Enter values that are about 5% slower than your ISP's claimed speed. For more details, see SQM (Smart Queue Management) on the OpenWrt wiki.
On Wireless Connections
Since OpenWrt is an access point, it can manage all the traffic flowing toward the many devices ("stations") that it serves. The OpenWrt Wi-Fi driver uses the following features to reduce latency:
-
Individual transmit queues for each wireless station/client. Each queue uses fq_codel to control the amount of data queued for that station.
-
Airtime Fairness (ATF) to give each wireless client a fair share of the airtime as opposed to the number of bytes sent/received with ordinary Wi-Fi drivers. This ensures a low-rate (slow) station does not use up all the airtime (the so-called "WiFi anomaly"). ATF uses round-robin scheduling of all active stations to ensure they each use only their fair share of the available airtime.
-
Airtime Queue Limits (AQL) to prevent the chip hardware from queueing too much data for any one wireless station. Many wireless chipsets have significant (unnecessary) queueing. By default, AQL analyzes the actual bit rate for that station and ensures that no more than 12 msec of data is queued for it.
Modern OpenWrt supports the Wi-Fi driver for certain chipsets.
-
What devices support this? All MediaTek MT76xx and MT79xx chipsets support the three features. We are working to crowd-source Wi-Fi chip info information about Qualcomm Atheros chip sets.
-
How do you configure this? The default settings for the Wi-Fi drivers work well for virtually all situations. For more information about configuration, see this note.
On Variable Speed Connections
Many ISP data rates vary from hour to hour (or even second by second), for example, cable modems, Starlink, 4G and 5G cellular plans, etc. This is a problem for the CAKE algorithm because it uses fixed speed settings to control the buffering. This leads to sub-optimal settings: if you set the speed too high and the actual link speed drops, then the latency goes up. If you set it too low, CAKE artificially limits the potential transfer rate.
The cake-autorate algorithm addresses this. It continually measures the traffic load and latency to adjust the upload and download settings of the CAKE algorithm. See the README for more details.
-
What devices support this? All modern OpenWrt devices can install the cake-autorate software.
-
How do you configure this? The INSTALLATION.md instructions at the Github repo describe the process.