Manual:Queues - PCQ: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
Megis (talk | contribs)
No edit summary
No edit summary
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Versions|2.9, v3, v4}}
__TOC__
__TOC__


==Usage==
==Usage==


==Classifiers==
PCQ was introduced to optimize massive QoS systems, where most of the queues are exactly the same for different sub-streams. For example a sub-stream can be download or upload for one particular client (IP) or connection to server.
 
PCQ algorithm is very simple - at first it uses selected classifiers to distinguish one sub-stream from another, then applies individual FIFO queue size and limitation on every sub-stream, then groups all sub-streams together and applies global queue size and limitation.
 
PCQ parameters:
* '''pcq-classifier''' (dst-address | dst-port | src-address | src-port; default: "")  : selection of sub-stream identifiers
* '''pcq-rate''' (number) : maximal available data rate of each sub-steam
* '''pcq-limit''' (number) : queue size of single sub-stream (in KiB)
* '''pcq-total-limit''' (number) : maximum amount of queued data in all sub-streams (in KiB)
 
 
[[Image:PCQ_Alg.png|400px|PCQ Algorithm]]
 
 
So instead of having 100 queues with 1000kbps limitation for download we can have one PCQ queue with 100 sub-streams
 
==Classification Examples==
 
To better understand classification we will take a list of 18 packet streams from specific address and port, to a specific address and port. Then we will choose a classifier and divide all 18 packet streams into PCQ sub-streams 
 
[[Image:PCQ_Example1.png|700px|Classifiers]]
 
[[Image:PCQ_Example2.png|700px|Classifiers]]
 
==PCQ Rate Examples==
 
Here it is possible to see what happens if PCQ-rate is, or isn't specified. I must noted that if both limits (pcq-rate and max-limit) are unspecified, queue behavior can be imprecise. So it is strongly suggested to have at least one of these options set.
 
 
[[Image:PCQ3.png|500px|Classifiers]]
 
 
[[Image:PCQ4.png|500px|Classifiers]]
 
==New PCQ implementation (v5.0RC5)==
 
PCQ was rewritten in v5.0RC4 to optimize it high throughput both in Mbps and pps. This implementation properly utilize all new Linux Kernel features, this makes PCQ faster and less resource demanding. 
 
Now as soon as new stream activates it will get 1/4th of rate with highest priority. If rate is "0" sub-stream will not have this feature (as 1/4th of "0" is "0")
 
This is necessary to know for one good reason:
Lets assume that sub-stream's rate is 10Mbps, so in the moment when new sub-stream will request traffic it will get first 2500k of traffic without limitation. This may result in higher that expected results in such programs as Speedtest.net. To avoid that make sure that Speedtest.net is not the first program that utilize bandwidth that you run on PC.
 
Also starting from v5.0RC5 PCQ have new features


[[Image:PCQ_Example1.png]]
PCQ Burst for sub-streams. PCQ will have burst implementation identical to Simple Queues and Queue Tree


PCQ parameters:
* '''pcq-burst-rate''' (number) : maximal upload/download data rate which can be reached while the burst for substream is allowed
* '''pcq-burst-threshold''' (number) :  this is value of burst on/off switch
* '''pcq-burst-time''' (time) : period of time, in seconds, over which the average data rate is calculated. (This is NOT the time of actual burst)


For detailed burst explanation refer to:
* [[Burst]]
PCQ also allows to use different size IPv4 and IPv6 networks as sub-stream identifiers . Before it was locked to single IP address. This is done mainly for IPv6 as customers from ISP point of view will be represented by /64 network, but devices in customers network will be /128. PCQ can be used for both of these scenarios and more.


==Limit and Total Limit==
PCQ parameters:
* '''pcq-dst-address-mask''' (number) : size of IPv4 network that will be used as  dst-address sub-stream identifier
* '''pcq-src-address-mask''' (number) : size of IPv4 network that will be used as  src-address sub-stream identifier
* '''pcq-dst-address6-mask''' (number) : size of IPV6 network that will be used as  dst-address sub-stream identifier
* '''pcq-src-address6-mask''' (number) : size of IPV6 network that will be used as  src-address sub-stream identifier




==Rate==
== See Also ==


* [[PCQ Examples]]


[[Category:Manual]]
[[Category:Manual|QueuesPCQ]]
[[Category:Unfinished]]
[[Category:QoS|QueuesPCQ]]
[[Category:Case Studies|QueuesPCQ]]

Latest revision as of 13:49, 2 December 2015

Applies to RouterOS: 2.9, v3, v4

Usage

PCQ was introduced to optimize massive QoS systems, where most of the queues are exactly the same for different sub-streams. For example a sub-stream can be download or upload for one particular client (IP) or connection to server.

PCQ algorithm is very simple - at first it uses selected classifiers to distinguish one sub-stream from another, then applies individual FIFO queue size and limitation on every sub-stream, then groups all sub-streams together and applies global queue size and limitation.

PCQ parameters:

  • pcq-classifier (dst-address | dst-port | src-address | src-port; default: "")  : selection of sub-stream identifiers
  • pcq-rate (number) : maximal available data rate of each sub-steam
  • pcq-limit (number) : queue size of single sub-stream (in KiB)
  • pcq-total-limit (number) : maximum amount of queued data in all sub-streams (in KiB)


PCQ Algorithm


So instead of having 100 queues with 1000kbps limitation for download we can have one PCQ queue with 100 sub-streams

Classification Examples

To better understand classification we will take a list of 18 packet streams from specific address and port, to a specific address and port. Then we will choose a classifier and divide all 18 packet streams into PCQ sub-streams

Classifiers

Classifiers

PCQ Rate Examples

Here it is possible to see what happens if PCQ-rate is, or isn't specified. I must noted that if both limits (pcq-rate and max-limit) are unspecified, queue behavior can be imprecise. So it is strongly suggested to have at least one of these options set.


Classifiers


Classifiers

New PCQ implementation (v5.0RC5)

PCQ was rewritten in v5.0RC4 to optimize it high throughput both in Mbps and pps. This implementation properly utilize all new Linux Kernel features, this makes PCQ faster and less resource demanding.

Now as soon as new stream activates it will get 1/4th of rate with highest priority. If rate is "0" sub-stream will not have this feature (as 1/4th of "0" is "0")

This is necessary to know for one good reason: Lets assume that sub-stream's rate is 10Mbps, so in the moment when new sub-stream will request traffic it will get first 2500k of traffic without limitation. This may result in higher that expected results in such programs as Speedtest.net. To avoid that make sure that Speedtest.net is not the first program that utilize bandwidth that you run on PC.

Also starting from v5.0RC5 PCQ have new features

PCQ Burst for sub-streams. PCQ will have burst implementation identical to Simple Queues and Queue Tree

PCQ parameters:

  • pcq-burst-rate (number) : maximal upload/download data rate which can be reached while the burst for substream is allowed
  • pcq-burst-threshold (number) : this is value of burst on/off switch
  • pcq-burst-time (time) : period of time, in seconds, over which the average data rate is calculated. (This is NOT the time of actual burst)

For detailed burst explanation refer to:

PCQ also allows to use different size IPv4 and IPv6 networks as sub-stream identifiers . Before it was locked to single IP address. This is done mainly for IPv6 as customers from ISP point of view will be represented by /64 network, but devices in customers network will be /128. PCQ can be used for both of these scenarios and more.

PCQ parameters:

  • pcq-dst-address-mask (number) : size of IPv4 network that will be used as dst-address sub-stream identifier
  • pcq-src-address-mask (number) : size of IPv4 network that will be used as src-address sub-stream identifier
  • pcq-dst-address6-mask (number) : size of IPV6 network that will be used as dst-address sub-stream identifier
  • pcq-src-address6-mask (number) : size of IPV6 network that will be used as src-address sub-stream identifier


See Also