FQ_CoDel - package scheduler that does everything for you
Download and distribute torrents at high speed, but because of this, ping jumps in online games and it becomes impossible to play? Mate makes a video call on Skype, and you do not want to disturb him? Keep file storage, which occupies the entire channel, and QoS tune laziness? Pouring youtube videos from your phone, can't you limit the speed?
fq_codel is a packet scheduler (qdisc) with active queue management that will solve all your problems! Still not believing? Watch the video!
The video shows that the computer on the left, connected via a regular home router with cerowrt firmware (modified by OpenWRT), opens sites much faster than a right computer with the same router, but with standard firmware.
Before reading this article, I recommend reading TCP Congestion Control or Why speed jumps (and immediately a small addition to it: TCP-YeAH now works fine on 3.9+ cores and you should use it). ')
Package Scheduler. What is it?
The packet scheduler (network scheduler, packet scheduler) is the code that manages the queue of network packets. It can drop packets if the buffer is full, change the order in which packets are sent to the network. At the moment, in the Linux kernel, the default is pfifo_fast, a queue management algorithm such as First in, first out, taking into account the ToS packet. Drop-tail schedulers (which is pfifo_fast) work simply - if the buffer is not full, put the package in a queue, otherwise we discard it, but schedulers with active flow control (Active Queue Management, one of which is fq_codel) are smarter: they can flag or discard packets before the queue is full, thus adjusting to channel utilization.
Bufferbloat
Bufferbloat is what you see when the channel is high. Words can describe it as a brake! You distribute torrents for the entire width of your channel, while loading pages in the browser takes much longer. Why is this happening? Everything is relatively simple: The torrent client constantly distributes, the packet queue is almost always full, and the packet to download the site (to get the IP address from the name, to connect to this address) is one of the last in the queue almost every time. With network flow scheduler algorithms with active flow control, this does not happen, because, first, they try to keep as few queues as possible, and secondly, they can mix them, so your return is a little bit (very close to the inconspicuous at home) will decrease, but sites will open much faster than with algorithms with fixed queue sizes and fifo, which are used by default. fq_codel is one of the most efficient and advanced algorithms using AQM.
With the use of pfifo_fast, ping with a clogged channel rises to 8ms.
At that time, using fq_codel, it only rises to 2ms.
Sounds great! How to try?
fq_codel has been included in the Linux kernel since version 3.5. You need a card whose driver supports BQL (many popular cards), but fq_codel can work without BQL, but you have to make an artificial shaper manually. In the simplest case, it will be sufficient to install root qdisc in fq_codel for a specific network interface: