ALTQ Scheduler Types¶
pfSense software contains several ALTQ scheduler types to cover a large range of shaping scenarios. The options for ALTQ are:
|Priority Queuing (PRIQ):|
|Manages prioritization of connections|
|Class-Based Queuing (CBQ):|
|Supports bandwidth sharing between queues and bandwidth limits|
|Hierarchical Fair Service Curve (HFSC):|
|Supports real-time bandwidth guarantees along with a hierarchical tree of nested queues.|
|Controlled Delay (CoDel):|
|Attempts to combat bufferbloat.|
|Fair Queuing (FAIRQ):|
|Attempts to fairly distribute bandwidth among all connections.|
PRIQ, CBQ, and HFSC are selectable in the shaper wizards and the wizards will show the proper options and create the queues based on the chosen ALTQ discipline.
Enabling ALTQ traffic shaping places an extra burden on the hardware, and there will be an overall potential network performance loss. On systems that have horsepower to spare, this may not be noticeable. On systems that operate close to their specification limits the firewall may see a degradation of performance. Whether the loss is worse than working without shaping depends on the individual workload.
Priority Queuing (PRIQ)¶
PRIQ is one of the easiest disciplines to configure and understand. The queues
are all directly under the root queue, there is no structure to have queues
under other queues with PRIQ as there is with HFSC and CBQ. It does not care
about bandwidth on interfaces, only the priority of the queues. The values for
priority go from
15, and the higher the priority number, the more
likely the queue is to have its packets processed.
PRIQ can be harsh to lesser queues, starving them when the higher priority queues need the bandwidth. In extreme cases, it is possible for a lower priority queue to have little or no packets handled if the higher priority queues are consuming all available resources.
Hierarchical Fair Service Curve (HFSC)¶
The HFSC traffic shaping discipline is very powerful. It is useful for services such as VoIP and video to deliver a minimum guaranteed amount of bandwidth.
Queues in HFSC are arranged in a hierarchy, or a tree, with root queues for each interface, parent queues underneath, and child queues nested under the parent queues (etc.). Each queue can have a set bandwidth and related options.
HFSC-specific Queue Options¶
HFSC supports a few queue options that are not supported by other disciplines. It is through these options that it achieves guaranteed real-time processing and link sharing.
The Service Curve (sc) is where bandwidth requirements for this queue are tuned.
|m1:||Burstable bandwidth limit|
|d:||Time limit for bandwidth burst, specified in milliseconds. (e.g. 1000 = 1 second)|
|m2:||Normal bandwidth limit|
For example, a connection needs m1 bandwidth within d time, but a normal maximum of m2. Within the initial time set by d, m2 is not checked, only m1. After d has expired, if the traffic is still above m2, it will be shaped. Most commonly, m1 and d are left blank, so that only m2 is checked.
Each of these values may be set for the following uses:
|Upper Limit:||Maximum bandwidth allowed for the queue. Will do hard bandwidth limiting. The m1 parameter here can also be used to limit bursting. In the time frame d a connection will not get more than m1 bandwidth.|
|Real Time:||Minimum bandwidth guarantee for the queue. This is only valid for child queues. The m1 parameter will always be satisfied in time frame d, and m2 is the maximum that this discipline will allow to be used. Note The value for m2 cannot exceed 30% of the available bandwidth from the parent queue.|
|Link Share:||The bandwidth share of a backlogged queue. Will share bandwidth between classes if the Real Time guarantees have been satisfied. The m2 value for Link Share will override the Bandwidth setting for the queue. These two settings are the same, but if both are set, m2 from Link Share is used.|
By combining these factors, a queue will get the bandwidth specified by the Real Time factors, plus those from Link Share, up to a maximum of Upper Limit. It can take a lot of trial and error, and perhaps a lot of arithmetic, but it may be worth it to ensure that network traffic is governed properly. For more information on m1, d, and m2 values for different scenarios, visit the pfSense Traffic Shaping forum.
Class-Based Queuing (CBQ)¶
Class-Based Queuing, or CBQ, is similar to HFSC in that is can have a tree of queues nested under other queues. It supports bandwidth limits (not guarantees like HFSC), priorities for queues, and it has the ability to allow queues to borrow bandwidth from their parent. Because of the simpler queue configuration, it can be a good alternative to HFSC especially if the firewall does not need to guarantee minimum bandwidths.
With CBQ, queue priorities range from
7 with higher numbers
indicating higher priority. Queues of an equal priority are processed in a
Though child queues can borrow from their parent queue, the sum of the bandwidth of the child queues cannot exceed the bandwidth of the parent. Therefore, CBQ is not an alternative to limiters for individual (e.g. per-IP address) bandwidth limits.
CBQ-Specific Queue Options¶
The CBQ discipline supports the concept of borrow, meaning that if the Borrow from other queues when available checkbox on the queue is enabled, then the queue will be able to borrow other available bandwidth from its parent queue. This will only allow a child queue to obtain up to the bandwidth of its immediate parent, if available, it will not borrow from other parent queues.
CoDel Active Queue Management¶
The CoDel Active Queue Management (AQM) discipline is short for Controlled Delay and is pronounced “coddle”. It was designed to combat problems associated with bufferbloat in networking infrastructure. Bufferbloat is described in detail at http://www.bufferbloat.net/projects/bloat/wiki/Introduction. Put simply, traffic can pile up and go in chunks rather than a smooth stream due to the size of buffers in network equipment. By controlling the delay of the traffic this effect can be lessened.
CoDel has no specific configuration controls or options. When activated for a queue, it will automatically attempt to manage traffic as described in the CoDel wiki at http://www.bufferbloat.net/projects/codel/wiki. It attempts to keep traffic delays low but does permit bursting, it controls delays but it does not pay attention to round-trip delay, load, or link speed, and it can automatically adjust if the link speed changes.
The target for CoDel is mid-range networking. It does not work well at very low bandwidth (1Mbit/s or less) and it does not gracefully handle large numbers of simultaneous flows or datacenter-grade traffic loads.
CoDel is not configurable using the wizard, but it does not require complex setup:
- Navigate to Firewall > Traffic Shaper, By Interface tab
- Select an interface (e.g. WAN)
- Set the Scheduler Type to CODEL
- Set an appropriate value for Bandwidth
- Click Save
- Repeat as needed for all other active WAN-type interface(s)
Fair Queuing (FAIRQ)¶
In FAIRQ, queues are monitored from highest to lowest priority, but the scheduler attempts to fairly distribute bandwidth among all connections.
When there is no contention for bandwidth, FAIRQ will send all waiting packets. When there is contention for bandwidth FAIRQ will start looking for queues that are not exceeding their limits, first starting with high priority queues and working toward lower queues. A packet in a full high priority queue is processed after a packet from a lower priority queue which is not full. If all queues are full, then FAIRQ will send a packet from the highest priority queue.
FAIRQ allows connections to exceed queue bandwidth, but will maintain an average consumption equal to the defined queue bandwidth.
FAIRQ is not currently supported in the traffic shaper wizard and it requires a manual configuration.