Queue types
CLI reference:/queue/type
A queue type is a named set of settings for one queuing algorithm. The algorithm is the kind of the queue type. It decides which packet a queue sends next, how many packets the queue holds and which packets it drops.
Queue types are in /queue/type. A queue type processes no traffic until a queue uses it. Three places use queue types:
- A simple queue: the
queueproperty takes two types, for upload and for download. - A queue tree: the
queueproperty takes one type. - An interface queue: the
queueproperty of/queue/interfacetakes one type for the packets that the interface transmits.
Kinds
| Kind | How it queues packets | Page |
|---|---|---|
pfifo, bfifo | One queue, first in, first out. The size is in packets or in bytes. | FIFO queue types |
mq-pfifo | One pfifo queue for each transmit queue of the interface. | FIFO queue types |
none | No software queue. | FIFO queue types |
red | One queue that drops packets at random before it is full. | RED |
sfq | A separate queue for each flow. The flows take turns. | SFQ |
pcq | A separate queue and a separate rate limit for each address or port. | PCQ |
codel | One queue that drops packets when they wait too long. | CoDel and FQ-CoDel |
fq-codel | A separate CoDel queue for each flow. | CoDel and FQ-CoDel |
cake | A separate queue for each flow and each host, with its own shaper. | CAKE |
Default queue types
RouterOS has ten default queue types. You can change their settings, but you cannot remove them.
/queue/type/print
Flags: * - DEFAULT
0 * name="default" kind=pfifo pfifo-limit=50
1 * name="ethernet-default" kind=pfifo pfifo-limit=50
2 * name="wireless-default" kind=sfq sfq-perturb=5 sfq-allot=1514
3 * name="synchronous-default" kind=red red-limit=60 red-min-threshold=10
red-max-threshold=50 red-burst=20 red-avg-packet=1000
4 * name="hotspot-default" kind=sfq sfq-perturb=5 sfq-allot=1514
5 * name="pcq-upload-default" kind=pcq pcq-rate=0 pcq-limit=50KiB
pcq-classifier=src- pcq-total-limit=2000KiB pcq-burst-rate=0
pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32
pcq-dst-address-mask=32 pcq-src-address6-mask=128
pcq-dst-address6-mask=128
6 * name="pcq-download-default" kind=pcq pcq-rate=0 pcq-limit=50KiB
pcq-classifier=dst- pcq-total-limit=2000KiB pcq-burst-rate=0
pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32
pcq-dst-address-mask=32 pcq-src-address6-mask=128
pcq-dst-address6-mask=128
7 * name="only-hardware-queue" kind=none
8 * name="multi-queue-ethernet-default" kind=mq-pfifo mq-pfifo-limit=50
9 * name="default-small" kind=pfifo pfifo-limit=10
A simple queue or a queue tree that you create without the queue property uses default-small.
Create a queue type and use it
This example creates an FQ-CoDel queue type with the default settings and uses it for both directions of a simple queue.
Simple queues do not limit FastTracked connections, and the default configuration has a FastTrack rule for established connections. The first two lines of the example disable this rule. See Simple queue for other ways to take traffic off FastTrack.
/ip/firewall/filter
disable [find action=fasttrack-]
/queue/type
add name=fq-codel-default kind=fq-codel
/queue/simple
add name=lan target=192.168.88.0/24 max-limit=20M/100M \
queue=fq-codel-default/fq-codel-default
In queue and in max-limit, the first value is for upload and the second value is for download.
Check that the queue uses the type:
/queue/simple/print where name=lan
0 name="lan" target=192.168.88.0/24 parent=none packet-marks="" priority=8/8
queue=fq-codel-default/fq-codel-default limit-at=0/0 max-limit=20M/100M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s bucket-size=0.1/0.1
How the kinds differ under load
When one transfer fills a rate limit, a FIFO queue holds the packets of every device in the same line. A packet from another device waits until the queue sends all packets in front of it. A longer queue means a longer wait.
PCQ, FQ-CoDel and CAKE keep separate queues. A packet from another device does not wait behind the transfer.
The delay of a FIFO queue follows from its size: 50 packets of 1500 bytes at 20 Mbps take 30 ms to send. In a test with one TCP transfer at a 20 Mbps limit, a ping from another device took about that long through a FIFO queue of 50 packets, and about 1 ms, the same as with no transfer, through PCQ, FQ-CoDel and CAKE.
When the router translates the addresses of the devices with NAT, PCQ still classifies by the address of the device. CAKE does the same when cake-nat=yes is set.
For the properties of each kind, see the /queue/type CLI reference.
Related topics
CAKE
CAKE (Common Applications Kept Enhanced) is an advanced queue management algorithm for RouterOS that optimizes network traffic handling through bandwidth shaping, flow isolation, and RTT-based congestion control. It supports Diffserv prioritization, ACK filtering, NAT handling, and various overhead compensation schemes for different link technologies.
CoDel and FQ-CoDel
CoDel and FQ-CoDel are RouterOS queue types that control how long packets wait in a queue. This page shows how to use FQ-CoDel on a rate-limited Internet connection with a simple queue or a queue tree, and CoDel on the rate limit of one device.
PCQ
Per Connection Queue (PCQ) is a RouterOS queue type that gives each address or port its own queue and rate limit. This page shows how to share a rate equally between devices and how to limit networks instead of single addresses.
FIFO queue types
PFIFO, BFIFO and MQ-PFIFO are the first-in, first-out queue types of RouterOS. This page shows how to set the queue size in packets or in bytes, and describes the default FIFO queue types and only-hardware-queue.
RED
Random Early Drop (RED) is a RouterOS queue type that drops packets at random before the queue is full. This page describes the RED settings and shows how to use a RED queue type in a simple queue.
SFQ
Stochastic Fairness Queuing (SFQ) is a RouterOS queue type that gives each flow its own queue and lets the flows take turns. This page describes the SFQ settings and shows how to use an SFQ queue type in a simple queue.