Introduction to QoS

QoS (Quality of Service) is used to provide different priority to different traffic, in order to control the delay and flapping, and decrease the packet loss rate. QoS can assure the normal transmission of critical business traffic when the network is overloaded or congested.

QoS is an assembly of techniques for controlling bandwidth, delay, flapping and packet loss in a network. All the QoS mechanisms are designed to affect at least one or even all the above features.

Hillstone devices support three types of QoS: application QoS, IP QoS and role QoS.

Note:

QoS Implementation

In general, QoS includes:

The graph below shows how QoS works:

As shown above, the packets are classified and marked after entering the system from the ingress interface. During the process, the policing mechanism will drop some of the packets. Then, the packets will be categorized again according to their marks. The congestion management and congestion avoidence mechanisms give different priorities to different types of packets so that the packets of higher priority can pass the gateway earlier in case of network congestion. Finally, the system will send packets which have been processed by QoS mechanisms out from the egress interfaces.

Classification and Marking

Classification and marking is the process of identifying the priority of each packet. This is the first step of QoS control, and should be done near the source hosts.

The packets are generally classified by their packet headers. The packet headers are examined closely by the rules specified in picture below:

The table below lists the criteria of classification:

Layer Description
Layer 1 Physical interface and sub-interface
Layer 2 MAC address, 802.1Q/p classification of service (CoS) bit string and VLAN mark
Layer 3 IP Precedence, DiffServ code point (DSCP) and source/destination IP address group
Layer 4 Port number (TCP or UDP)
Layer 7 Application type or application signature

The fields that can carry marks include:

Ethernet frames are marked by specifying the 802.1p user priority (CoS) of 802.1Q header. The Layer 2 Ethernet frame has only eight types of services (from 0 to 7), which are:

CoS value/IP precedence Application
7
Reserved
6
Reserved
5
Voice
4
Video Conference
3
Call Signaling
2
High-priority Data
1
Medium-priority Data
0
Best-effort Data

Similar to CoS, IP precedence can be marked with 8 types of services (0 to 7). See the table above.

DSCP (DiffServ Code Point) provides a 6-bit field for QoS marking, among which 3 bits are the same as IP precedence, and the other 3 bits are ToS fields. Thus, the DSCP value range is 0 to 63. The graph below shows the DSCP and IP precedence bits:

A DSCP value can be represented in two forms: digital and keyword. The keyword form of DSCP value is also known as Per-Hop Behavior (PHB). Till now there are three types of defined PHBs: Best-Effort (BE or DSCP 0), Assured Forwarding (AF) and Expedited Forwarding (EF). For more information, see RFC2547, 2597 and 3246. The DSCP value plays a significant role in the subsequent QoS processing.

Policing and Shaping

QoS policing and shaping mechanisms are used to identify traffic violation and make responses. Policing and shaping adopt the same algorithms for identifying traffic violation, but they make different responses.

The policing mechanism checks traffic in real time, and takes immediate actions according to the settings when it discovers violation. For example, the policing mechanism can identify if the traffic payload exceeds the defined traffic flow rate, and then decide to re-mark or drop the excessive parts. It can control the traffic of both inbound and outbound directions.

The shaping mechanism works together with queuing mechanism. It sends all traffic to one interface and make sure that the traffic will never exceed the defined flow rate so that the traffic can go through that interface smoothly. The shaping mechanism is typically applied to the outbound direction.

The differences between policing and shaping are listed below:

Policing Shaping
TCP re-connection due to packets being dropped Typically traffic delay, but seldom TCP re-connection.
Inflexible and unadaptable The queuing mechanism can reduce network congestion.
Ingress interface and egress interface control Egress interface control
No cache or rate limit Cache and rate limit

Hillstone devices use token bucket algorithm to determine if the network traffic has violated rules. Token bucket is an abstract container that holds tokens. The system puts tokens into the bucket at a defined rate. When the bucket is full, the tokens will overflow it and the number of tokens in the bucket will not change. The token bucket uses its tokens to transmit packets. When the bucket has enough tokens to transmit the packets, the bucket is known as conforming to the rule, otherwise it excesses the rule. The parameters in traffic evaluation include:

When evaluating traffic, the control operations may vary from different situations which include: 1) C-bucket has enough tokens; 2) C-bucket tokens are insufficient but E-bucket is sufficient; 3) both C-bucket and E-bucket do not have enough tokens.

The graph below illustrates the double token buckets algorithm:

As shown above, B is the size of data packet; Tc is the number of CBS tokens; Te is the number of EBS tokens. When the CBS is larger than the packet size, the packet conforms and will be processed according to system settings; when the CBS is smaller than the packet size, the system will EBS; if the EBS is larger than the packet size, the packet exceeds and will be processed according to system settings; but if the EBS is smaller than the packet size, the packet violates the rule and will be processed according to other settings.

Congestion Management

Congestion management mechanism is one of the most important tools in QoS control. It uses queuing theory to solve problems in the congested interfaces. As the data rate can be different among different networks, congestion may happen to both wide area network (WAN) and local area network (LAN). Only when an interface is congested will the queuing theory begin to work. Hillstone devices support class-based weighted fair queuing (CBWFQ) and low latency queuing (LLQ).

Related Topics: