-
Notifications
You must be signed in to change notification settings - Fork 1
sqm
OpenWrt/LEDE has pre-built packages for controlling Bufferbloat - the undesirable latency that arises when the router buffers too much data.
Bufferbloat is most evident when the link is heavily loaded. It causes bad performance for voice and video conversations, causes gamers to lag out, and generally makes people say, "The Internet is slow today."
The "luci-app-sqm" package of OpenWrt/LEDE solves the problem of Bufferbloat. In a three-minute installation and configuration, you'll have a much more lively network connection. Here's how:
TL;DR Install LEDE 17.01 or newer, and follow the video at: https://www.youtube.com/watch?v=FvYhifdQ92Q
Before you can optimize your network, you need to know its current state. Run a speed test to find your down/upload link speeds.
- When your network is relatively quiet, use DSLReports Speedtest at: http://www.dslreports.com/speedtest You will need this information below. (See recommended settings for how to get the most out of the dslreports speedtest)
- This is probably a good time to Back up your Configuration. (Optional, but always a good idea.)
Install the luci-app-sqm package. Watch the Youtube Video that shows these steps:
- Uninstall qos-scripts and luci-app-qos if they are installed. To do this, choose System -> Software, then scroll down the list in the Installed Packages tab. Click Remove if either of these scripts is installed.
- Install the luci-app-sqm package. It will automatically install other required packages. To do this:
- From the LuCI web GUI, go to System -> Software, then click Update Lists
- Click the Available packages tab, and find luci-app-sqm. Click Install
- Start and Enable the SQM scripts. To do this, choose System -> Startup
- Click Start to start the SQM process
- Click Enable to start the SQM process when the route reboots
The default values described below work quite well for most situations. You may be able to improve performance by experimenting with settings, see A Little More SQM Tuning below.
To configure SQM, choose Network -> SQM QoS to see the Smart Queue Management (SQM) GUI.
- In the Basic Settings tab:
- Check the Enable box
- Set the Interface name: to your wide area link (usually //eth0// for OpenWrt/LEDE, but check Network -> Interfaces to find the name for the WAN port.)
- Set the Download and Upload speeds to 80-95% of the speed you measured above in the Preparation.
- In the Queue Discipline tab, you can leave the settings at their default.
- Choose //cake// as the Queueing Discipline
- Choose //piece_of_cake.qos// as the Queue Setup Script
- The Advanced Configuration defaults are designed to work well out of the box.
- In the Link Layer Adaptation tab, choose the kind of link you have:
- //For VDSL// - Choose Ethernet, and set per packet overhead to 22
- //For DSL of any other type// - Choose ATM, and set per packet overhead to 44
- //For Cable or other kinds of connections// - Choose Ethernet, and set per packet overhead to 18
- //For true ethernet// - Choose Ethernet, and set per packet overhead to 38
- Click Save & Apply. That's it!
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's uploading or downloading a lot of data.
You've reduced your connection's bufferbloat!
The steps above will control latency well without additional effort. The 80-95% figures mentioned above are good first-cut estimates, but you can often gain more speed while still controlling latency by making a couple experiments to adjust the settings.
If you want to spend a few more minutes tuning, do these steps.
- Increase the Download speed until the latency begins to increase, then go back to a slightly lower value.
- Do the same for the Upload speed entry.
- It may be worth your time to tweak the two a bit up and down to find a sweet spot for your connection and usage.
- We recommend you use DSLReports Speed Test for the latency tests because it measures both speed and latency at the same time.
Note: If you have a DSL link, the experiments above may produce Download and Upload values that are actually higher than the original speed test results. This is OK: the ATM framing bytes of a DSL link add an average of 9% overhead, and these settings simply tell SQM how to make up for that overhead.
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 "Speedboost", which usually gives you an extra 10 mbits or so for the first 10 seconds (so the speed test will look good(!)). Don't be surprised if the "right" setting for your queue rates is significantly lower than the no-SQM speed test results. You may need to tune the speeds down from your initial settings to get the latency to the point you need for your own usage of your connection.
Note: You can also experiment with the other settings (read docs:guide-user:network:traffic-shaping:sqm-details for more information), but they will not make nearly as large a difference as ensuring that the Download and Upload speeds are maximized.
Note: Also check the docs:guide-user:network:traffic-shaping:sqm-details#faq and docs:guide-user:network:traffic-shaping:sqm-details#troubleshooting_sqm guides.