24.7. Queue limits¶
This section documents the queue limits model, which is used by the traffic control to limit the NetDevices queueing delay. It operates on the transmission path of the network node.
The reduction of the NetDevices queueing delay is essential to improve the effectiveness of Active Queue Management (AQM) algorithms. Careful assessment of the queueing delay includes a byte-based measure of the NetDevices queue length. In this design, traffic control can use different byte-based schemes to limit the queueing delay. Currently the only available scheme is DynamicQueueLimits, which is modelled after the dynamic queue limit library of Linux.
24.7.1. Model Description¶
The source code for the model lives in the directory src/network/utils.
The model allows a byte-based measure of the netdevice queue. The byte-based measure more accurately approximates the time required to empty the queue than a packet-based measure.
To inform the upper layers about the transmission of packets, NetDevices can call a couple of functions:
void NotifyQueuedBytes (uint32_t bytes): Report the number of bytes queued to the device queuevoid NotifyTransmittedBytes (uint32_t bytes): Report the number of bytes transmitted by device
Based on this information, the QueueLimits object can stop the transmission queue.
In case of multiqueue NetDevices this mechanism is available for each queue.
The QueueLimits model can be used on any NetDevice modelled in ns-3.
24.7.1.1. Design¶
An abstract base class, class QueueLimits, is subclassed for specific byte-based limiting strategies.
Common operations provided by the base class QueueLimits include:
void Reset (): Reset queue limits statevoid Completed (uint32_t count): Record the number of completed bytes and recalculate the limitint32_t Available () const: Return how many bytes can be queuedvoid Queued (uint32_t count): Record number of bytes queued
24.7.1.1.1. DynamicQueueLimits¶
Dynamic queue limits (DQL) is a basic library implemented in the Linux kernel to limit the Ethernet queueing delay. DQL is a general purpose queue length controller. The goal of DQL is to calculate the limit as the minimum number of bytes needed to prevent starvation.
Three attributes are defined in the DynamicQueueLimits class:
HoldTime: The DQL algorithm hold timeMaxLimit: Maximum limitMinLimit: Minimum limit
The DQL algorithm hold time is 1 s. Reducing the HoldTime increases the responsiveness of DQL with consequent greater number of limit variation events. Conversely, increasing the HoldTime decreases the responsiveness of DQL with a minor number of limit variation events. The limit calculated by DQL is in the range from MinLimit to MaxLimit. The default values are respectively 0 and DQL_MAX_LIMIT. Increasing the MinLimit is recommended in case of higher NetDevice transmission rate (e.g. 1 Gbps) while reducing the MaxLimit is recommended in case of lower NetDevice transmission rate (e.g. 500 Kbps).
24.7.1.1.2. Effect of BQL on latency with small queue size¶
BQL is essentially used to limit Netdevices queueing delay. It limits this queueing delay by restricting the queue size by a byte-based measure of the queue size.
Here we assume the SegmentSize for TcpSocket is 1448 bytes. Datarate for the bottleneck link is 50Mbps with a bottleneck link delay of 5ms.
If the queue size of DropTailQueue is three packets, BQL keeps the limit steady at 3004 bytes. With the P2P header, our packet size is 1502 bytes. With the BQL limit of 3004, our queue will store two packets in the queue. Thus the packets would have an extra two packet’s transmission delay worth of queueing delay.
If the queue size of DroptailQueue is one packet. BQL will keep the limit at 2642 bytes. Our packet size is 1502, and queue size is just one packet BQL limit won’t have any effect as it is more than the queue size. In this case, the packets would have an extra one packet’s transmission delay worth of queue delay.
Hence in both cases, BQL works, but the queueing delay is lower when the queue size of DropTailQueue is one packet compared to when the size is three packets.
There is one trace source in DynamicQueueLimits class that may be hooked:
Limit: Limit value calculated by DQL
24.7.2. Usage¶
24.7.2.1. Helpers¶
A typical usage pattern is to create a traffic control helper and configure the queue limits type and attributes from the helper, such as this example:
TrafficControlHelper tch;
uint32_t handle = tch.SetRootQueueDisc("ns3::PfifoFastQueueDisc", "Limit", UintegerValue(1000));
tch.SetQueueLimits("ns3::DynamicQueueLimits", "HoldTime", StringValue("4ms"));
then install the configuration on a NetDevices container
tch.Install (devices);