Quality of service (QoS) is a measure of telecommunications, that is, it is the expected service class in terms of packet loss, latency, jitter and bandwidth.
QoS is defined to realize the following:
The major flow control measures consist of traffic measurement, traffic policing, traffic shaping, congestion management, and congestion avoidance. They control service load and resource allocation from different perspectives. Before implementing the flow control measures, the controlled service load should be identified first. This is realized through flow classification.
The traffic classification, which is significant only when combined with other traffic control measures, is implemented to provide services in different cases. To take what traffic control actions depend on the packet transmitting stage and the current network load. For example, the port performs traffic policing when a packet comes into the network based on the committed access rate (CAR), shapes the packet before it gets out of the node, performs queue adjustment when congestion happens and takes congestion avoidance measures when the congestion is intensified.
With different network layered objectives and traffic distribution, an edge router mainly performs the following QoS functions:
Traffic classification recognizes a packet that has some features according to a rule. Hence, traffic classification is the prerequisite and a basis for providing services differently.
You can use a simple rule for traffic classification. For example, the system can recognize the traffic with different priority features according to the type of service (ToS) field of an IP packet header. This is called simple traffic classification. You can also use a complex rule for traffic classification. That is, packets can be classified according to the information (such as MAC address, source address, destination address, and protocol type or port number of an application) at the integrated link layer, network layer and transport layer. This is called complex traffic classification. The general criteria of traffic classification are confined to the header information of an encapsulated packet.
Traffic classification aims to provide services differently, but it must be related to a traffic control and resource allocation action. Otherwise, it may fail to achieve the goal. The traffic control action depends upon the traffic QoS and the current load conditions in the network. That is, when a packet enters a network, it is policed according to the committed access rate and is shaped before it emerges out of a node. Queue management should be conducted during congestion and measures to avoid congestion should be taken during intensified congestion.
Before an NE performs traffic measurement or shaping, the NE determines whether the traffic meets the specification and implements the control policy according to the specification. Usually, a token bucket is used as a tool for measuring traffic.
A token bucket can be considered as a container for storing tokens of a certain volume. The system stores tokens at the set speed. If the token bucket is full, the excessive tokens overflow and tokens are not added to the bucket, as shown in Figure 1.
When a token bucket is used to measure the traffic size, the standard is to determine whether there are enough tokens in the bucket for packet transfer. If there are enough tokens in a bucket for packet transfer, it is considered that the traffic conforms to this specification, namely, "conforming". Otherwise, it is considered that the traffic does not conform to or exceed the standard, namely, "excess".
Traffic policing uses two token buckets that represent different allowable burst levels. The rates of the two token buckets are CIR and PIR. The sizes are CBS and MBS (CBS is smaller than MBS). Hence, the two token buckets are also referred to as bucket C and bucket P. When measuring traffic, an NE implements different flow control policies according to the scenarios "bucket C has enough tokens", "bucket C has not enough tokens but bucket P has enough tokens" and "both buckets C and P have not enough tokens".
The typical function of traffic policing is to supervise the specification of traffic entering a network and to restrict it within a committed range or impose a "penalty" on any excess traffic to protect the interests of operators and network resource from possible damage. For example, traffic policing can restrict an HTTP application to less than 50% of the network bandwidth. If the traffic of a connection exceeds the standard, traffic policing discards the packet or resets the priority of the packet.
Traffic shaping is a measure to adjust the output traffic rate. A typical application is to control traffic output based on CAR specification of the downstream network node. Traffic shaping and traffic policing mainly differ in that the former caches the packets that exceed the standard - usually by putting them into a buffer or queue. If they are put into a weighted fair queuing (WFQ) (which is described in the next section), this is called generic traffic shaping (GTS).
As shown in Figure 2, if there are enough tokens in a token bucket, these cached packets are evenly sent out. Traffic shaping and traffic policing also differ in the fact that the former may increase delay while the latter seldom leads to additional delay.