Quality of Service · Topic 2 of 4
HTB Limits, Priority and Burst
Learn the HTB dual limitation with limit-at and max-limit, how priority shares spare bandwidth, and how burst limit, burst threshold and burst time work.
- 5 min
limit-atis the guaranteed rate, also called CIR.max-limitis the ceiling, also called MIR.- Children get their
limit-atfirst, then spare bandwidth is shared by priority.
What it is
Each HTB queue has two rate limits, a priority, and an optional burst.
The two limits are the guaranteed rate and the ceiling. The priority decides who gets spare bandwidth first. The burst lets a queue go above its ceiling for a short time.
Together these settings let you promise a minimum to important traffic and still allow it to use unused capacity.
How it works
RouterOS shares bandwidth in stages, using the limits and the priority.
Dual limitation
The two limits are set on every queue.
| Parameter | Common name | Meaning |
|---|---|---|
| limit-at | CIR, committed rate | The rate the queue is promised, if the parent has enough |
| max-limit | MIR, maximum rate | The rate the queue may never exceed |
/queue tree add name=voip parent=ether1 packet-mark=voip-pkt limit-at=1M max-limit=4M priority=1
/queue tree add name=data parent=ether1 packet-mark=data-pkt limit-at=2M max-limit=10M priority=8
A queue can be in one of three situations. Below limit-at, it sends its guaranteed rate without asking anyone.
Between limit-at and max-limit, it may borrow spare bandwidth from its parent. At max-limit, it stops growing.
How the bandwidth is shared
HTB works in rounds. First, every child gets its limit-at. Then the remaining bandwidth of the parent is handed out to children that want more, and priority decides the order.
No child receives more than its max-limit.
If the parent runs short of bandwidth, the guarantees may not all be met. The sum of the children's limit-at should therefore not exceed what the parent can supply.
Guarantees are only possible if the parent has the capacity. Make the sum of the child limit-at values no larger than the parent max-limit.
Priority
Priority is a number from 1 to 8. Number 1 is the highest priority and 8 is the lowest.
Priority only matters when a queue wants more than its limit-at. The queue with the better priority gets spare bandwidth first.
Priority does not change the guaranteed rate, and it has an effect only on leaf queues. An inner queue ignores it.
| Setting | Effect |
|---|---|
| Low priority number | Receives spare bandwidth earlier |
| High priority number | Receives spare bandwidth later |
| Same priority | Queues share the spare bandwidth |
Priority does nothing when the link is idle, because all queues can reach their ceilings. It shows its value when the link is full.
Why use both limits
Without limit-at, a busy link could starve an important queue completely. With it, voice has a protected minimum, and priority makes sure voice gets spare capacity ahead of bulk downloads. The ceiling stops one class from taking over everything.
Burst
Burst lets a queue exceed max-limit for a short time. This helps short transfers such as a web page load feel fast, while long downloads still settle at the limit.
Three parameters control it.
| Parameter | Meaning |
|---|---|
| burst-limit | The highest rate allowed while bursting |
| burst-threshold | The average rate below which bursting is allowed |
| burst-time | The period over which the average rate is measured |
/queue tree add name=web parent=ether2 packet-mark=web-pkt max-limit=2M burst-limit=6M burst-threshold=1500k burst-time=10s
RouterOS measures the average rate over burst-time. While that average stays below burst-threshold, the queue may go up to burst-limit. When the average climbs above the threshold, bursting stops and the queue falls back to max-limit.
Note that burst-time is not how long the burst lasts. It is the window for the average. The real burst length depends on how fast the average rises.
Set burst-limit above max-limit and burst-threshold below it.
What to remember for the exam
Eight facts cover most questions on this topic.
limit-atis the guaranteed rate, also called CIR.max-limitis the ceiling, also called MIR.- Children get their
limit-atfirst, then spare bandwidth is shared by priority. - Priority 1 is the best and 8 is the worst, and it applies to leaf queues.
- Priority matters only when the link is busy.
- The sum of the child
limit-atvalues should fit inside the parent capacity. burst-limitis the burst ceiling,burst-thresholdis the average rate that allows burst, andburst-timeis the averaging window.- Burst stops when the average rate rises above the threshold.
Common mistakes
These four mistakes appear often.
Thinking priority 8 is the best. Priority 1 is the highest, and 8 is the lowest.
Setting limit-at above max-limit. The guarantee can never be larger than the ceiling.
Expecting priority to help on an idle link. With free capacity every queue reaches its ceiling anyway.
Reading burst time as the burst length. It is the averaging window, not the duration of the burst.
Check yourself
Work through these three questions.
What happens to a queue between
limit-atandmax-limit?It may borrow spare bandwidth from its parent, but it cannot go above
max-limit.Which priority number is served first?
Priority 1 is the highest, so it receives spare bandwidth before the others.
What does
burst-thresholdcontrol?It is the average rate below which bursting is allowed, and bursting stops when the average rises above it.
Topic 2 of 4 in Quality of Service
Test yourself on Quality of Service
The full MikroTik MTCTCE question bank has 479 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by MikroTik. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.