Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:network:traffic-shaping:sqm [2021/04/15 13:50] – [Configuring the SQM Bufferbloat Packages] palebloodsky | docs:guide-user:network:traffic-shaping:sqm [2024/05/10 14:52] – remove a dead link, and small language tweaks palebloodsky | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Smart Queue Management | + | ====== |
| - | OpenWrt has a pre-built | + | OpenWrt has a package |
| - | OpenWrt calls the package Smart Queue Management (SQM), although it's also called [[wp> | + | |
| - | Bufferbloat is most evident when the link is heavily loaded. It causes bad performance for voice and video conversations, | + | Install '' |
| - | The " | + | ===== Overview ===== |
| - | **TL;DR** Video guide: [[https:// | + | Bufferbloat is most evident when a connection is heavily loaded with downloads or uploads. It causes increased latency (ping), resulting in poor performance for realtime apps like VoIP, video chat, lag in online games, and generally makes the internet feel unresponsive. This can be mitigated with SQM. |
| - | Advanced | + | SQM is an integrated system that performs per-packet/per-flow network scheduling, active queue management (AQM), traffic shaping, rate limiting, and QoS prioritization. In comparison, “classic” AQM only manages queue length and “classic” QoS only does prioritization. |
| - | ===== Preparation: | + | |
| - | Before you can optimize your network, you need to know its current state. Run a speed test to find your down/upload link speeds. To do this: | + | SQM is heavily CPU dependent. Slower devices may not be able to [[https://forum.openwrt.org/t/so-you-have-500mbps-1gbps-fiber-and-need-a-router-read-this-first/90305|keep up]] with your connection speed. |
| - | /* I removed the discussion of the very cool speedtest-netperf package because it's a distraction from getting SQM configured. We should advise readers simply to use DSLReports... - richb-hanover */ | + | |
| - | /* | + | |
| - | To install the //speedtest-netperf// package: | + | |
| - | * From LuCI web GUI: | + | |
| - | * choose **System | + | |
| - | * Or, from cmd: < | + | |
| - | To use the script, ssh to the OpenWRT device and run the following (example results shown, additional options are available): | + | SQM is incompatible |
| - | < | + | |
| - | speedtest-netperf.sh -H netperf-west.bufferbloat.net -t 20 | + | |
| - | 2020-08-25 14:35:40 Starting speedtest for 20 seconds per transfer session. | + | |
| - | Measure speed to netperf-west.bufferbloat.net (IPv4) while pinging gstatic.com. | + | |
| - | Download and upload sessions are sequential, each with 5 simultaneous streams. | + | |
| - | ..................... | + | |
| - | | + | |
| - | Latency: [in msec, 21 pings, 0.00% packet loss] | + | |
| - | Min: 19.125 | + | |
| - | 10pct: | + | |
| - | | + | |
| - | Avg: 31.586 | + | |
| - | 90pct: | + | |
| - | Max: 63.253 | + | |
| - | CPU Load: [in % busy (avg +/- std dev) @ avg frequency, 18 samples] | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | netperf: | + | |
| - | ..................... | + | |
| - | | + | |
| - | Latency: | + | |
| - | Min: 19.627 | + | |
| - | 10pct: | + | |
| - | | + | |
| - | Avg: 21.521 | + | |
| - | 90pct: | + | |
| - | Max: 26.307 | + | |
| - | CPU Load: [in % busy (avg +/- std dev) @ avg frequency, 19 samples] | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | netperf: | + | |
| - | </ | + | |
| - | */ | + | |
| - | * When your network is relatively quiet, use DSLReports Speedtest at: http://www.dslreports.com/speedtest You will need this information in the next step. (See [[https:// | + | |
| - | * //This is probably a good time to [[docs: | + | |
| - | + | ||
| - | ===== Configuring the SQM Bufferbloat Packages ===== | + | |
| - | The default values described below work quite well for most situations. They represent conservative estimates which is generally desirable compared to under-estimating. You may be able to improve performance by experimenting with settings, see [[# | + | ===== Preparation: |
| - | To configure SQM, choose | + | Before you can optimize your network, you need to know its current state. When your internet is quiet, run a speed test to find your peak download/ |
| + | * Run a speed test from [[https:// | ||
| + | * If you are using this OpenWrt device as an [[docs: | ||
| + | |||
| + | ===== Configuration ===== | ||
| + | |||
| + | In LuCI go to **Network -> SQM QoS**. | ||
| - In the **Basic Settings** tab: | - In the **Basic Settings** tab: | ||
| * Check the **Enable** box | * Check the **Enable** box | ||
| - | * Set the **Download** and **Upload** speeds to 80-95% of the speed you measured above * Set the **Interface name:** to your wide area link (usually //eth0// for OpenWrt/ | + | * Set the **Interface name** to your internet |
| - | in the Preparation. | + | * Set the **Download** and **Upload** speeds to 90% of what you measured in Preparation |
| - | - In the **Queue Discipline** tab, you can leave the default settings or set the following: | + | - In the **Queue Discipline** tab: |
| - | * Choose //cake// as the Queueing Discipline | + | * Choose //cake// as the Queueing Discipline |
| * Choose // | * Choose // | ||
| - | * The Advanced Configuration | + | * Advanced Configuration |
| - | - In the **Link Layer Adaptation** tab, choose the kind of link you have: | + | - In the **Link Layer Adaptation** tab, select your link type (optional: set mpu see [[: |
| - | * //For VDSL// - Choose **Ethernet**, | + | * //For VDSL// - Choose **Ethernet**, |
| - | * //For DSL of any other type// - Choose **ATM**, and set per packet | + | * //For DSL of any other type// - Choose **ATM**, and set overhead 44 (mpu 96). |
| - | * //For Cable// - Choose **Ethernet**, | + | * //For DOCSIS |
| - | * //For true ethernet | + | * //For Ethernet |
| - | * //When in Doubt, it's better to overestimate// | + | * //If unsure, it's better to overestimate// |
| - | - Click **Save & Apply**. That's it! | + | - Click **Save & Apply**. |
| + | |||
| + | That's it! You can confirm mitigation of bufferbloat by re-running the speedtest. Any increased ping during download/ | ||
| + | |||
| + | ===== Results ===== | ||
| + | |||
| + | As an example, the user below is running OpenWrt 23.05 on a [[toh: | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ^ | ||
| + | | QoS | Download | ||
| + | | None | 532 Mbits | 37 Mbits | 12 ms | +18 ms | +38 ms | B | B | | ||
| + | | SQM | 495 Mbits | 28 Mbits | 12 ms | +0 ms | +0 ms | A+ | A + | | ||
| - | Measure your latency again with the speed test. You should notice that the measured ping times should only be slightly larger during the downloads and uploads. Try using VoIP, Skype, Facetime, gaming, DNS, and general web browsing. They should be much more pleasant, even if someone' | + | ===== A Little More Tuning |
| - | You've reduced your connection' | + | 1. The steps above will handle latency well, but you may improve this further via adjusting the dl/ul limits and with these steps: |
| - | ===== A Little More SQM Tuning | + | |
| - | The steps above will control | + | * Increase the Download speed limit and retest until latency |
| + | * Repeat the same for the Upload speed. | ||
| + | * Use [[https:// | ||
| + | * For DSL, the experiments above may produce download/ | ||
| + | * For DOCSIS cable, some providers trick speed tests by adding 10-15% over-provisioning for the first 10 seconds (so speed tests look better!). | ||
| - | If you want to spend a few more minutes tuning, do these steps. | + | 2. Cake is the [[https:// |
| - | * Increase the Download speed until the latency begins to increase, then go back to a slightly lower value. | + | 3. To set your link **mpu** (read [[docs:guide-user: |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | ||
| - | **Note:** If you have a DSL link, the experiments above may produce Download and Upload values that are actually | + | |
| - | **Note:** If you use a cable modem, you should use a speed test that runs for a longer time. Cable modem makers have gamed speed tests thoroughly by using " | + | 4. Check the [[docs: |
| - | **Note:** You can also experiment with the other settings (read [[docs:guide-user: | + | 5. Consider Cake tuning parameters: [[https:// |
| - | **Note:** Also check the [[docs: | + | 6. To use SQM it is necessary to disable hardware flow offloading as per [[https:// |