1TC(8) Linux TC(8)
2
3
4
6 sfq - Stochastic Fairness Queueing
7
9 tc qdisc ... perturb seconds quantum bytes
10
11
13 Stochastic Fairness Queueing is a classless queueing discipline avail‐
14 able for traffic control with the tc(8) command.
15
16 SFQ does not shape traffic but only schedules the transmission of pack‐
17 ets, based on 'flows'. The goal is to ensure fairness so that each
18 flow is able to send data in turn, thus preventing any single flow from
19 drowning out the rest.
20
21 This may in fact have some effect in mitigating a Denial of Service
22 attempt.
23
24 SFQ is work-conserving and therefore always delivers a packet if it has
25 one available.
26
28 On enqueueing, each packet is assigned to a hash bucket, based on
29
30 (i) Source address
31
32 (ii) Destination address
33
34 (iii) Source port
35
36 If these are available. SFQ knows about ipv4 and ipv6 and also UDP, TCP
37 and ESP. Packets with other protocols are hashed based on the 32bits
38 representation of their destination and the socket they belong to. A
39 flow corresponds mostly to a TCP/IP connection.
40
41 Each of these buckets should represent a unique flow. Because multiple
42 flows may get hashed to the same bucket, the hashing algorithm is per‐
43 turbed at configurable intervals so that the unfairness lasts only for
44 a short while. Perturbation may however cause some inadvertent packet
45 reordering to occur.
46
47 When dequeuing, each hashbucket with data is queried in a round robin
48 fashion.
49
50 The compile time maximum length of the SFQ is 128 packets, which can be
51 spread over at most 128 buckets of 1024 available. In case of overflow,
52 tail-drop is performed on the fullest bucket, thus maintaining fair‐
53 ness.
54
55
57 limit Upper limit of the SFQ. Can be used to reduce the default length
58 of 128 packets.
59
60 perturb
61 Interval in seconds for queue algorithm perturbation. Defaults
62 to 0, which means that no perturbation occurs. Do not set too
63 low for each perturbation may cause some packet reordering.
64 Advised value: 10
65
66 quantum
67 Amount of bytes a flow is allowed to dequeue during a round of
68 the round robin process. Defaults to the MTU of the interface
69 which is also the advised value and the minimum value.
70
71
73 To attach to device ppp0:
74
75 # tc qdisc add dev ppp0 root sfq perturb 10
76
77 Please note that SFQ, like all non-shaping (work-conserving) qdiscs, is
78 only useful if it owns the queue. This is the case when the link speed
79 equals the actually available bandwidth. This holds for regular phone
80 modems, ISDN connections and direct non-switched ethernet links.
81
82 Most often, cable modems and DSL devices do not fall into this cate‐
83 gory. The same holds for when connected to a switch and trying to send
84 data to a congested segment also connected to the switch.
85
86 In this case, the effective queue does not reside within Linux and is
87 therefore not available for scheduling.
88
89 Embed SFQ in a classful qdisc to make sure it owns the queue.
90
91
93 o Paul E. McKenney "Stochastic Fairness Queuing", IEEE INFOCOMM'90
94 Proceedings, San Francisco, 1990.
95
96
97 o Paul E. McKenney "Stochastic Fairness Queuing", "Interworking:
98 Research and Experience", v.2, 1991, p.113-131.
99
100
101 o See also: M. Shreedhar and George Varghese "Efficient Fair Queu‐
102 ing using Deficit Round Robin", Proc. SIGCOMM 95.
103
104
106 tc(8)
107
108
110 Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>. This manpage maintained by
111 bert hubert <ahu@ds9a.nl>
112
113
114
115
116
117iproute2 8 December 2001 TC(8)