MikroTik PCQ Calculator
Size PCQ queues properly: work out the per-user rate, queue limits and total limit for a shared uplink, and generate the queue tree that implements it.
Result
/queue type
add name=pcq-download kind=pcq pcq-rate=0 pcq-classifier=dst-address pcq-limit=50 pcq-total-limit=10000
add name=pcq-upload kind=pcq pcq-rate=0 pcq-classifier=src-address pcq-limit=50 pcq-total-limit=10000
/ip firewall mangle
add chain=forward action=mark-packet new-packet-mark=lan-down passthrough=no out-interface=bridge-lan comment="Netvorx PCQ"
add chain=forward action=mark-packet new-packet-mark=lan-up passthrough=no in-interface=bridge-lan
/queue tree
add name=total-download parent=global max-limit=1000000k
add name=users-download parent=total-download packet-mark=lan-down queue=pcq-download limit-at=900000k max-limit=1000000k
add name=total-upload parent=global max-limit=1000000k
add name=users-upload parent=total-upload packet-mark=lan-up queue=pcq-upload limit-at=900000k max-limit=1000000kAbout MikroTik PCQ Calculator
PCQ (Per Connection Queue) is the RouterOS mechanism for sharing a link fairly among many users with a single rule. Instead of one queue per customer, PCQ classifies traffic by address and creates a sub-queue dynamically, so one entry scales to thousands of users.
Classifier direction is everything
For download traffic, classify on dst-address - the destination is the LAN user. For upload, classify on src-address. Getting this backwards creates one giant sub-queue keyed on the internet side, and the fairness you were trying to build disappears.
pcq-limit and pcq-total-limit
pcq-limit is the packet depth of each sub-queue; 50 is a good default. Too small and you drop packets on healthy bursts, too large and you build bufferbloat. pcq-total-limit caps memory across all sub-queues - size it to roughly the user count times the per-queue limit, and keep an eye on router RAM.
Common use cases
- Sharing a hotspot or apartment-block uplink fairly.
- Preventing one downloader from starving an office link.
- Sizing a WISP sector before adding more subscribers to it.
Edge cases and gotchas
- Queue trees act on packet marks, so the mangle rules must exist and match before the tree does anything.
- PCQ operates on the router CPU - on low-end hardware, high packet rates will hit the CPU ceiling before the configured limit.
- Fast Track bypasses queues entirely. Exclude marked traffic from Fast Track or the shaping will simply not apply.