# How does policing prevent LLQ queue starvation? (QoS)

A networking course that I follow mentions the following information about LLQ (Low Latency Queuing) in QoS

LLQ designates one (or more) queues as strict priority queues. This means that if there is traffic in the queue, the scheduler will always take the next packet from that queue until it's empty.

However, it has the downside of potentially starving other queues if there is always traffic in the designated strict priority queue

Policing can control the amount of traffic allowed in the strict priority queue so that it can't take all of the link's bandwidth

How exactly does Policing prevent the queue starvation problem?

We basically limit the amount of packets that can be in that priority queue, but that doesn't change the fact that if a priority queue fills up with packets, the scheduler will always try to empty that priority queue first before moving on to others, potentially starving them. Or does it?

How exactly does Policing prevent the queue starvation problem?

You adjust the policing threshold so that the input rate to the priority queue is less than the output rate.

To give you an analogy: Imagine having a tunnel that has only 1 lane. But there are 4 lanes merging into the one at the entrance of the tunnel. There are lights to make sure that the same amount of cars can go into the tunnel from any lane. The light cicle thru all the lanes. 10 cars from lane1, 10 cars from lane2 and so on.

per minute, we can let around 40 cars thru the tunnel, thus our throughput is 40c/min

There is one lane, called the LLQ lane. If a car approaches, all lights have to switch to red, and continue with the green cycle, once the LLQ lane is empty. If there were 40 cars per minute coming into the LLQ lane, all other lanes would be starved, which is not good. So in front of the LLQ lane, we put a policeman, making sure that not more than 2 cars per minute can enter this lane. Therefore we can limit the LLQ thrughput and make sure we dont starve the other lanes.

What do we do with the 3rd car under a minute that wants to go into the LLQ lane you ask? we can either drop him (crash) or redirect him to a normal queue where he has to stand in line and wait for the lights to turn green. Usually you set the limit to a value that this would only happen if the marking of the traffic has failed or is getting exploited.

that doesn't change the fact that if a priority queue fills up with packets, the scheduler will always try to empty that priority queue first before moving on to others, potentially starving them. Or does it?

It does.

Policing limits the maximum amount of time that the LLQ is preferred over all others. In other words, the scheduler will always try to empty the priority queue first unless it has exceeded its policed amount. That provides the opportunity to the other priorities to get serviced as well.

For example, if the policed threshold is set to 20% and the LLQ traffic exceeds that threshold (averaged over some defined time period), it is temporarily downgraded to normal priority until it doesn't exceed the threshold any more.

Very often, a low-latency requirement is accompanied to a low-bandwidth requirement (think of VoIP data) - prioritized scheduling exploits that fact. Policing is often used as a safeguard, so that during a malfunction or a DoS attack the prioritized protocol cannot starve the rest of the network.