Network scheduler
A network scheduler, also called packet scheduler, is an arbiter program on a node in packet switching communication network. It manages the sequence of network packets in the transmit and receive queues of the network interface controller, which is a circular data buffer. There are several network schedulers available for the different operating system kernels, that implement many of the existing network scheduling algorithms.
The network scheduler logic decides, in a way similar to statistical multiplexers, which network packet to forward next from the buffer. The buffer works as a queuing system, storing the network packets temporarily until they are transmitted. The buffer space may be divided into different queues, with each of them holding the packets of one flow according to configured packet classification rules; for example, packets can be divided into flows by their source and destination IP addresses. Network scheduling algorithms and their associated settings determine how the network scheduler manages the buffer.
Also, network schedulers are enabling accomplishment of the active queue management and traffic shaping.
Network scheduling algorithms
In the course of time several network scheduling algorithms (also called queueing discipline, qdisc or queueing algorithm) have been developed. Each of the scheduling algorithms used internally for these queuing disciplines provides specific reordering or dropping of network packets inside various transmit or receive buffers.[1][2] Queuing disciplines are commonly used as attempts to compensate for various networking conditions, like reducing the latency for certain classes of network packets, and are generally used as part of the quality of service (QoS) measures.[3][4][5]
Examples of algorithms suitable for managing network traffic include:
- AVQ (adaptive virtual queue)[6]
- CBQ (class-based queueing) discipline
- CHOKe (CHOose and Keep for responsive flows, CHOose and Kill for unresponsive flows) is a variant of RED
- CoDel (controlled delay) and fair/flow queue CoDel
- Credit-based fair queuing
- DRR (deficit round robin) and DWRR, implementation e.g. written by Patrick McHardy for the Linux kernel[7] and published under the GNU General Public License.
- FaQ (FavourQueue)[8]
- GCRA (generic cell rate algorithm)
- HFF (heavy-hitter filter)[9]
- HFSC (hierarchical fair-service curve)
- HTB (hierarchical token bucket)[10]
- QFQ (quick fair queueing)[11]
- FQ (fair queuing) and WFQ (weighted fair queuing)
- FIFO (first in, first out)
- pkt_sched: fq: fair queue packet scheduler [12]
- NETEM network emulator[13]
- PIE (proportional integral controller enhanced)[14]
- RED (random early detection) as well as ARED (advanced random early detection, GRED (generalized random early detection), RRED (robust random early detection) and WRED (weighted random early detection)
- RR (round-robin) and WRR (weighted round robin)
- SFB (stochastic fair blue) as well as RSFB (resilient SFB)
- SFQ (stochastic fairness queuing)[15]
- TBF (token bucket filter)[16]
- TEQL (trivial link equalizer)
Several of the above have been implemented as Linux kernel modules[17] and are freely available.
Bufferbloat
Bufferbloat is a phenomenon in packet-switched networks generally, in which excess buffering of packets causes high latency and packet delay variation (also known as jitter), as well as reducing the overall network throughput. When a router device is configured to use excessively large buffers, even very high-speed networks can become practically unusable for many interactive applications like voice calls, chat, and even web surfing.
The CoDel algorithm attempts to reduce this problem by improving upon the RED algorithm. CoDel is less prone to the effects of bufferbloat than the common tail drop disciplines.
Terminology
- Active queue management (AQM) – the employment of an arbiter program
- Network traffic control – an umbrella term for all measures aimed at the control of traffic
- Traffic shaping – a form of AQM, where the available bandwidth is being limited to match certain use cases
- Link sharing – this term is used when more individuals or customers share the same Internet connection
- Traffic prioritizing – a form of AQM, that selectively prioritizes certain network packets (e.g. VoIP-packets)
- TCP Turbo – by prioritizing ACK-packets on the upload, a slow-down of the download rate of a TCP connection is prevented
- Bandwidth management – the management of the available bandwidth
Implementations
Linux kernel
The Linux kernel packet scheduler is configured with the user-space CLI utility program tc
(traffic control). As the default queuing discipline, it uses a FIFO implementation called pfifo_fast,[18] although systemd since its version 217 changes the default queuing discipline to fq_codel.[19] The Linux kernel packet scheduler is an integral part of the Linux kernel network stack and manages the ring buffers of all NICs, by working on the layer 2 of the OSI model and handling e.g. Ethernet frames. It manages the transmit and receive buffers of all NICs installed in a computer.
The user space programs ifconfig
and ip
enable system administrators to configure the buffer sizes txqueuelen
and rxqueuelen
for each device separately, with their units being number of Ethernet frames regardless of their size. The Linux kernel's network stack contains several other buffers, which are not managed by the network scheduler. The overall size of all buffers has been the point of critique by the Bufferbloat project, which provided a partial solution with CoDel that has been primarily tested in OpenWrt.
Another network scheduler is being developed as part of Netfilter and nftables.
eBPF was mainlined into Linux kernel 3.18 and since Linux kernel version 4.1, eBPF filters can be attached to the Linux kernel packet scheduler's classifiers.[20] To be more precise, the patches to the eBPF mainlined into for 4.1 extend the "classic" BPF programmable tc classifier by extending its scope also to native eBPF code, thus allowing userspace to implement own custom, 'safe' C like classifiers that can then be compiled with the LLVM eBPF back-end to an eBPF elf file and loaded into the kernel via iproute2's tc
, and be JITed in the kernel.[21]
BSD
ALTQ is the implementation of a network scheduler for BSDs. It is not to be confused with the Berkeley Packet Filter.
See also
- Network congestion
- Quality of service
- Queue (abstract data type)
- Queueing theory
- Statistical time division multiplexing
- Traffic shaping
- Traffic classification
- Type of service
References
- ↑ "Traffic Control HOWTO: Classless Queuing Disciplines (qdiscs)". tldp.org. Retrieved November 24, 2013.
- ↑ Saravanan Radhakrishnan (September 30, 1999). "QoS Support in Linux: Queuing Disciplines". qos.ittc.ku.edu. Retrieved March 18, 2014.
- ↑ "Traffic Control HOWTO: Components of Linux Traffic Control". tldp.org. Retrieved November 24, 2013.
- ↑ "Traffic Control HOWTO: Traditional Elements of Traffic Control". tldp.org. Retrieved November 24, 2013.
- ↑ "Queuing Disciplines: Order of Packet Transmission and Dropping" (PDF). tau.ac.il. October 25, 2006. Retrieved March 18, 2014.
- ↑ http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.108.4477&rep=rep1&type=pdf
- ↑ "DRR Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "FavorQueue: a Parameterless Active Queue Management to Improve TCP Traffic Performance" (PDF).
- ↑ "Heavy-Hitter Filter qdisc". kernel.org.
- ↑ "HTB Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "QFQ Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "Fair Queue packet scheduler committed to Linux kernel 3.12".
- ↑ "Network emulator Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "Proportional Integral controller Enhanced (PIE)". kernel.org.
- ↑ "SFQ Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "TBF Linux kernel network scheduler module". kernel.org. Retrieved 2013-09-07.
- ↑ "The Linux kernel network scheduler". kernel.org. 2012-12-26. Retrieved 2013-09-07.
- ↑ "Linux Advanced Routing and Traffic Control HOWTO, Section 9.2.1. pfifo_fast". lartc.org. 2012-05-19. Retrieved 2014-09-19.
- ↑ "systemd System and Service Manager: NEWS file". freedesktop.org. 2015-05-22. Retrieved 2015-06-09.
- ↑ "Linux kernel 4.1, Section 11. Networking". kernelnewbies.org. 2015-06-21.
- ↑ "Linux kernel packet scheduler#classifiers". wiki.OpenWrt.org.