Difference between revisions of "Manual:Queue"

From MikroTik Wiki
Jump to: navigation, search
Line 24: Line 24:
  
 
If no settings are specified in upload/download/total part of the queue corresponding queue it will not be created. This way creation of global-total queues can be avoided if separate upload/download limitation is used. This also means that you must change at least one setting in the simple queue to get simple queue working.
 
If no settings are specified in upload/download/total part of the queue corresponding queue it will not be created. This way creation of global-total queues can be avoided if separate upload/download limitation is used. This also means that you must change at least one setting in the simple queue to get simple queue working.
 +
 +
Simple queues have strict order - each packet must go through every queue until it will meet all identifiers. (In case of 1000 queues, packet for last queue will need to proceed through 999 queues before it reach the destination)
 
   
 
   
 
===Flow Identifiers===
 
===Flow Identifiers===
Line 45: Line 47:
  
 
* '''packet-marks''' (Comma separated list of) : allows to use marked packets from '''/ip firewall mangle'''. Take look at this [[:Image:Packet flow.png|packet flow diagram]]. You need to make sure that packets are marked before the simple queues (before global-in HTB queue) - that is mangle chain '''prerouting''' or else targets download limitation will not work.
 
* '''packet-marks''' (Comma separated list of) : allows to use marked packets from '''/ip firewall mangle'''. Take look at this [[:Image:Packet flow.png|packet flow diagram]]. You need to make sure that packets are marked before the simple queues (before global-in HTB queue) - that is mangle chain '''prerouting''' or else targets download limitation will not work.
 +
  
 
===HTB Properties===
 
===HTB Properties===
  
* '''parent''' (Name of , or ''none'') : assigns this queue as a child queue for selected target. Target queue can be HTB queue or any other previously created simple queue
+
* '''parent''' (Name of , or ''none'') : assigns this queue as a child queue for selected target. Target queue can be HTB queue or any other previously created simple queue. In order for traffic to reach child queues, parent queues must capture all necessary traffic.
 
* '''priority''' (1..8) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its '''limit-at''' before child with lower priority and after that child queue with higher priority will have chance to reach its '''max-limit''' before child with lower priority. Priority have nothing to do with bursts.
 
* '''priority''' (1..8) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its '''limit-at''' before child with lower priority and after that child queue with higher priority will have chance to reach its '''max-limit''' before child with lower priority. Priority have nothing to do with bursts.
 
* '''queue''' (''SOMETHING/SOMETHING'') : Choose the type of the upload/download queue. Queue types can be created [[#Queue_Types|here]]
 
* '''queue''' (''SOMETHING/SOMETHING'') : Choose the type of the upload/download queue. Queue types can be created [[#Queue_Types|here]]
Line 73: Line 76:
 
* '''bytes''' (read-only/read-only) : number of bytes processed by this queue
 
* '''bytes''' (read-only/read-only) : number of bytes processed by this queue
 
* '''packets''' (read-only/read-only) : number of packets processed by this queue
 
* '''packets''' (read-only/read-only) : number of packets processed by this queue
+
* '''queued-bytes''' (read-only/read-only) : number of bytes waiting in the queue
* '''queued-bytes''' (read-only/read-only) :  
+
* '''queued-packets''' (read-only/read-only) : number of packets waiting in the queue
* '''queued-packets''' (read-only/read-only) :  
+
* '''dropped''' (read-only/read-only) : number of dropped packets
 
+
* '''overlimits''' (read-only/read-only) :  
* '''dropped''' (read-only/read-only) :  
 
* '''overlimits''' (read-only/read-only) :
 
 
* '''lends''' (read-only/read-only) :  
 
* '''lends''' (read-only/read-only) :  
 
* '''borrows''' (read-only/read-only) :  
 
* '''borrows''' (read-only/read-only) :  
* '''pcq-queues''' (read-only/read-only) :  
+
* '''pcq-queues''' (read-only/read-only) : number of PCQ substreams, if queue type is PCQ
  
 
And corresponding options for global-total HTB queue:
 
And corresponding options for global-total HTB queue:
Line 99: Line 100:
  
 
==Queue Tree==
 
==Queue Tree==
 +
 +
Queue tree creates only one directional queue in one of the HTBs. It is also the only way how to add queue on the separate interface. This way it is possible to ease mangle configuration - you don't need separate marks for download and upload - only upload will get to private interface and only download will get to Public interface.
 +
 +
Also it is possible to have double queuing (example:prioritization of traffic in global-in or global-out, limitation per client on the outgoing interface)
 +
If you have simple queues and queue tree in the same HTB - simple queues will get traffic first.
 +
 +
Queue tree is not ordered - all traffic pass it together.
 +
 +
 +
===Flow Identifiers===
 +
* '''name''' (Text) : Unique queue identifier that can be used as '''parent''' option value for other queues
 +
* '''packet-marks''' (Comma separated list of) : allows to use marked packets from '''/ip firewall mangle'''. Take look at this [[:Image:Packet flow.png|packet flow diagram]]. You need to make sure that packets are marked before the simple queues (before global-in HTB queue)
 +
 +
 +
===HTB Properties===
 +
 +
* '''parent''' (Name of , or ''none'') : assigns this queue as a child queue for selected target. Target queue can be HTB queue or any other previously created queue
 +
* '''priority''' (1..8) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its '''limit-at''' before child with lower priority and after that child queue with higher priority will have chance to reach its '''max-limit''' before child with lower priority. Priority have nothing to do with bursts.
 +
* '''queue''' (''SOMETHING'') : Choose the type of the queue. Queue types can be created [[#Queue_Types|here]]
 +
* '''limit-at''' (''NUMBER'') : normal data rate that is guaranteed to a target
 +
* '''max-limit''' (''NUMBER'') : maximal data rate that is allowed for a target to reach
 +
* '''burst-limit''' (''NUMBER'') : maximal data rate which can be reached while the burst is active
 +
* '''burst-time''' (''TIME'') : period of time, in seconds, over which the average data rate is calculated. (This is NOT the time of actual burst)
 +
* '''burst-threshold''' (''NUMBER'') : when average data rate is below this value - burst is allowed, as soon as average data rate reach this value -  burst is denied.  (basically this is burst on/off switch). For optimal burst behavior this value should above '''max-limit''' value and below '''burst-limit''' value
 +
 +
 +
===Statistics===
 +
 +
* '''rate''' (read-only/read-only) : average queue passing data rate in bytes per second
 +
* '''packet-rate''' (read-only/read-only) : average queue passing data rate in packets per second
 +
* '''bytes''' (read-only/read-only) : number of bytes processed by this queue
 +
* '''packets''' (read-only/read-only) : number of packets processed by this queue
 +
* '''queued-bytes''' (read-only/read-only) : number of bytes waiting in the queue
 +
* '''queued-packets''' (read-only/read-only) : number of packets waiting in the queue
 +
* '''dropped''' (read-only/read-only) : number of dropped packets
 +
* '''overlimits''' (read-only/read-only) :
 +
* '''lends''' (read-only/read-only) :
 +
* '''borrows''' (read-only/read-only) :
 +
* '''pcq-queues''' (read-only/read-only) : number of PCQ substreams, if queue type is PCQ
 +
 +
 
==Queue Types==
 
==Queue Types==
 +
 +
bfifo-limit -- Maximum number of bytes that the BFIFO queue can hold
 +
copy-from -- Item number
 +
kind -- Queue type
 +
name -- Associative name of the queue type
 +
pcq-classifier -- The classifier of grouping traffic flow
 +
pcq-limit -- PCQ queue limit
 +
pcq-rate -- Maximal data rate assigned to one group (bits/s)
 +
pcq-total-limit -- Number of packets that can hold the whole PCQ queue
 +
pfifo-limit -- Maximum number of packets that the PFIFO queue can hold
 +
red-avg-packet -- Used by RED for average queue size calculations
 +
red-burst -- Number of packets allowed for bursts of packets when there are no p
 +
ackets in the queue
 +
red-limit -- RED queue limit in bytes
 +
red-max-threshold -- The average queue size at which packet marking probability
 +
is the highest
 +
red-min-threshold -- Average queue size in bytes
 +
sfq-allot -- How often to change hash function
 +
sfq-perturb -- Amount of data in bytes that can be sent in one round-robin round
 +
 +
 
==Interface Queue==
 
==Interface Queue==
  
 +
interface
 +
queue
  
 
[[Category:Manual]]
 
[[Category:Manual]]
 
[[Category:Unfinished]]
 
[[Category:Unfinished]]

Revision as of 14:32, 29 September 2008

Queues

Submenu level: /queue

Queue implementation in MikroTik RouterOS is based on Hierarchical Token Bucket (HTB). HTB allows to create hierarchical queue structure and determine relations between queues(parent-child, child priority).

In RouterOS it is possible to add queue in 4 different places (HTBs):

  • global-in: represents all the input interfaces in general (INGRESS queue). Queues attached to global-in apply to traffic that is received by the router before the packet filtering
  • global-out: represents all the output interfaces in general (EGRESS queue).
  • global-total: represents all input and output interfaces together (in other words it is aggregation of global-in and global-out). Used in case when customers have single limit for both, upload and download.
  • <interface name>: - represents one particular outgoing interface. Only traffic that is designated to go out via this interface will pass this HTB queue

There are two ways how to add queues in RouterOS:

  • /queue simple menu - designed to ease configuration of simple, everyday queuing tasks (such as single client upload/download limitation, p2p traffic limitation, etc.).
  • /queue tree menu - for implementing advanced queuing tasks (such as global prioritization policy, user group limitations) requires market packet flows from /ip firewall mangle facility.

Simple Queues

Submenu level: /queue simple

Simple queues represents three queues in one. Single simple queue will create one queue in global-in, one queue in global-out and one queue in global-total.

If no settings are specified in upload/download/total part of the queue corresponding queue it will not be created. This way creation of global-total queues can be avoided if separate upload/download limitation is used. This also means that you must change at least one setting in the simple queue to get simple queue working.

Simple queues have strict order - each packet must go through every queue until it will meet all identifiers. (In case of 1000 queues, packet for last queue will need to proceed through 999 queues before it reach the destination)

Flow Identifiers

  • name (Text) : Unique queue identifier that can be used as parent option value for other queues
  • target-addresses (multiple choice: IP address/netmask) : list/range of IP addresses that will be limited by this queue. This is one of two possible options that allow queue to determine what direction is target upload and what direction is target download.
  • interface (Name of interface, or all) : identifies interface the target is connected to. useful in case when it is impossible to determine targets address. This is second of two possible options that allow queue to determine what direction is target upload and what direction is target download.


IF both target-address and interface is not specified queue will be unable to make difference between upload from download and will limit all traffic twice. Use only one of these options at the same queue - in case there will point to opposite sides queue will not work.


  • direction (One of both, upload, download) : allow to enable one-directional limitation for simple queues (disable other direction).
  • time (time-time, sat | fri | thu | wed | tue | mon | sun{+}; default: "") : allow to specify time when particular queue will be active. Router must have correct time settings.
  • dst-address (IP address/netmask) : allows to select only stream for limitation (from target address to this destination address)
  • p2p (all-p2p | bit-torrent | blubster | direct-connect | edonkey | fasttrack | gnutella | soulseek | winmx) : allow to select unencrypted packets of particular p2p for limitation
  • packet-marks (Comma separated list of) : allows to use marked packets from /ip firewall mangle. Take look at this packet flow diagram. You need to make sure that packets are marked before the simple queues (before global-in HTB queue) - that is mangle chain prerouting or else targets download limitation will not work.


HTB Properties

  • parent (Name of , or none) : assigns this queue as a child queue for selected target. Target queue can be HTB queue or any other previously created simple queue. In order for traffic to reach child queues, parent queues must capture all necessary traffic.
  • priority (1..8) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its limit-at before child with lower priority and after that child queue with higher priority will have chance to reach its max-limit before child with lower priority. Priority have nothing to do with bursts.
  • queue (SOMETHING/SOMETHING) : Choose the type of the upload/download queue. Queue types can be created here
  • limit-at (NUMBER/NUMBER) : normal upload/download data rate that is guaranteed to a target
  • max-limit (NUMBER/NUMBER) : maximal upload/download data rate that is allowed for a target to reach
  • burst-limit (NUMBER/NUMBER) : maximal upload/download data rate which can be reached while the burst is active
  • burst-time (TIME/TIME) : period of time, in seconds, over which the average upload/download data rate is calculated. (This is NOT the time of actual burst)
  • burst-threshold (NUMBER/NUMBER) : when average data rate is below this value - burst is allowed, as soon as average data rate reach this value - burst is denied. (basically this is burst on/off switch). For optimal burst behavior this value should above max-limit value and below burst-limit value

And corresponding options for global-total HTB queue:

  • total-queue (SOMETHING/SOMETHING): corresponds to queue only for global-total queue
  • total-limit-at (NUMBER/NUMBER): corresponds to limit-at only for global-total queue
  • total-max-limit (NUMBER/NUMBER): corresponds to max-limit only for global-total queue
  • total-burst-limit (NUMBER/NUMBER): corresponds to burst-limit only for global-total queue
  • total-burst-time (TIME/TIME): corresponds to burst-time only for global-total queue
  • total-burst-threshold (NUMBER/NUMBER): corresponds to burst-threshold only for global-total queue


Statistics

  • rate (read-only/read-only) : average queue passing data rate in bytes per second
  • packet-rate (read-only/read-only) : average queue passing data rate in packets per second
  • bytes (read-only/read-only) : number of bytes processed by this queue
  • packets (read-only/read-only) : number of packets processed by this queue
  • queued-bytes (read-only/read-only) : number of bytes waiting in the queue
  • queued-packets (read-only/read-only) : number of packets waiting in the queue
  • dropped (read-only/read-only) : number of dropped packets
  • overlimits (read-only/read-only) :
  • lends (read-only/read-only) :
  • borrows (read-only/read-only) :
  • pcq-queues (read-only/read-only) : number of PCQ substreams, if queue type is PCQ

And corresponding options for global-total HTB queue:

  • total-rate (read-only): corresponds to rate only for global-total queue
  • total-packet-rate (read-only): corresponds to packet-rate only for global-total queue
  • total-bytes (read-only): corresponds to bytes only for global-total queue
  • total-packets (read-only): corresponds to packets only for global-total queue
  • total-queued-bytes (read-only): corresponds to queued-bytes only for global-total queue
  • total-queued-packets (read-only): corresponds to queued-packets only for global-total queue
  • total-dropped (read-only): corresponds to dropped only for global-total queue
  • total-overlimits (read-only): corresponds to overlimits only for global-total queue
  • total-lends (read-only): corresponds to lends only for global-total queue
  • total-borrows (read-only): corresponds to borrows only for global-total queue
  • total-pcq-queues (read-only): corresponds to pcq-queues only for global-total queue


Queue Tree

Queue tree creates only one directional queue in one of the HTBs. It is also the only way how to add queue on the separate interface. This way it is possible to ease mangle configuration - you don't need separate marks for download and upload - only upload will get to private interface and only download will get to Public interface.

Also it is possible to have double queuing (example:prioritization of traffic in global-in or global-out, limitation per client on the outgoing interface) If you have simple queues and queue tree in the same HTB - simple queues will get traffic first.

Queue tree is not ordered - all traffic pass it together.


Flow Identifiers

  • name (Text) : Unique queue identifier that can be used as parent option value for other queues
  • packet-marks (Comma separated list of) : allows to use marked packets from /ip firewall mangle. Take look at this packet flow diagram. You need to make sure that packets are marked before the simple queues (before global-in HTB queue)


HTB Properties

  • parent (Name of , or none) : assigns this queue as a child queue for selected target. Target queue can be HTB queue or any other previously created queue
  • priority (1..8) : Prioritize one child queue over other child queue. Does not work on parent queues (if queue has at least one child). One is the highest, eight is the lowest priority. Child queue with higher priority will have chance to reach its limit-at before child with lower priority and after that child queue with higher priority will have chance to reach its max-limit before child with lower priority. Priority have nothing to do with bursts.
  • queue (SOMETHING) : Choose the type of the queue. Queue types can be created here
  • limit-at (NUMBER) : normal data rate that is guaranteed to a target
  • max-limit (NUMBER) : maximal data rate that is allowed for a target to reach
  • burst-limit (NUMBER) : maximal data rate which can be reached while the burst is active
  • burst-time (TIME) : period of time, in seconds, over which the average data rate is calculated. (This is NOT the time of actual burst)
  • burst-threshold (NUMBER) : when average data rate is below this value - burst is allowed, as soon as average data rate reach this value - burst is denied. (basically this is burst on/off switch). For optimal burst behavior this value should above max-limit value and below burst-limit value


Statistics

  • rate (read-only/read-only) : average queue passing data rate in bytes per second
  • packet-rate (read-only/read-only) : average queue passing data rate in packets per second
  • bytes (read-only/read-only) : number of bytes processed by this queue
  • packets (read-only/read-only) : number of packets processed by this queue
  • queued-bytes (read-only/read-only) : number of bytes waiting in the queue
  • queued-packets (read-only/read-only) : number of packets waiting in the queue
  • dropped (read-only/read-only) : number of dropped packets
  • overlimits (read-only/read-only) :
  • lends (read-only/read-only) :
  • borrows (read-only/read-only) :
  • pcq-queues (read-only/read-only) : number of PCQ substreams, if queue type is PCQ


Queue Types

bfifo-limit -- Maximum number of bytes that the BFIFO queue can hold copy-from -- Item number kind -- Queue type name -- Associative name of the queue type pcq-classifier -- The classifier of grouping traffic flow pcq-limit -- PCQ queue limit pcq-rate -- Maximal data rate assigned to one group (bits/s) pcq-total-limit -- Number of packets that can hold the whole PCQ queue pfifo-limit -- Maximum number of packets that the PFIFO queue can hold red-avg-packet -- Used by RED for average queue size calculations red-burst -- Number of packets allowed for bursts of packets when there are no p ackets in the queue red-limit -- RED queue limit in bytes red-max-threshold -- The average queue size at which packet marking probability is the highest red-min-threshold -- Average queue size in bytes sfq-allot -- How often to change hash function sfq-perturb -- Amount of data in bytes that can be sent in one round-robin round


Interface Queue

interface queue