Tuesday 24 April 2012

Traffic Shaping vs. Traffic Policing


Traffic Shaping  vs. Traffic Policing
==========================

Why Traffic Policing and Traffic shaping are required?

In order to maintain QOS (quality of service) in network, these are required.  QOS means service provider agreed upon certain level of service to the customer.To achieve QOS, the service provider needs to manage the Traffic across the network.

Traffic shaping and Policing are required for managing the Traffic that exceeds the specific rate.

Traffic Shaping?

“Traffic shaping” just does the Rate Limiting. In other words, it delays traffic (some or all datagrams) to bring them into compliance with a desired traffic profile.
  
Traffic Shaping just delays the traffic by buffering, it stores the traffic in queues. Traffic shaping will not drop the packets.

Generally service providers often force the customer to adhere to a specific policy of service (or committed rate).This policy is referred to as the Service Level Agreement (SLA) between the customer and service provider. 
  
Shaping is usually implemented on the customer side, and will buffer traffic that exceeds the service provider’s committed rate.Buffering traffic will often create delay and jitter, which can negatively impact sensitive traffic types. Shaping also requires sufficient memory to queue buffered traffic.
  
Here router receives a traffic more than 128kbs date rate, then router needs to shape the traffic  to meet the end device traffic rate.Suppose if router receives 160 kbps of inbound traffic , but  outbound line rate is 128 kbps, in this case the router has to shape the traffic to compliance with the end router rate.
       
          

 Shaping can only occur on outbound traffic on an interface.

Configuring Traffic Shaping

Shaping is usually implemented on the customer side, and will buffer traffic that exceeds the provider’s committed rate.Shaping will thus slow the traffic rate and siphon out traffic in compliance with the provider’s SLA.

Cisco IOS devices support multiple methods of traffic shaping:

Generic Traffic Shaping (GTS) – implements shaping on a per Interface basis using the traffic-shape command.

Class-Based Shaping – implements shaping on a per-class basis using the shape command within a MQC policy-map.

Distributed Traffic Shaping (DTS) – offloads traffic shaping from the router processor to Versatile Interface Processors (VIPs).DTS is only available on high-end Cisco platforms.

Frame Relay Traffic Shaping (FRTS) – implements Frame-Relay specific shaping mechanisms, such as BECN or FECN. FRTS is only
available on a Frame-Relay interface or subinterface, and is covered extensively in the Frame-Relay guide.

To configure basic Generic Traffic Shaping (GTS):
Router(config)# interface serial0/0
Router(config-if)# traffic-shape rate 256000 64000 64000
The traffic-shape rate command is followed by three values, representing:
• The committed information rate (CIR)
• The normal burst rate (Bc)
• The excess burst rate (Be)

What is Traffic Policing?

Think of traffic policing as a bouncer guarding the door to a nightclub.
When the club is full, he denies entry and turns patrons away. This is similar to how policing works.

Packets are limited to a certain bandwidth, preventing the circuit from becoming congested.  Any traffic exceeding the specified rate limit is discarded.

Policing is usually implemented on the provider side, and will either drop or re-mark traffic that exceeds the provider’s committed rate. 

TCP traffic that is dropped will be forced to resend, which may result in TCP global synchronization or starvation issues. Policing can be implemented for both inbound and outbound traffic on an interface.

Transfer Rate – The Token Bucket System
Cisco describes the regulation of a transfer rate as a token bucket system, which is comprised of three parts:

Committed Information Rate (CIR) – specifies the traffic rate dictated by the SLA, measured in bits per second (bps).

Burst Rate (Bc) – specifies the amount of traffic to be sent within a given time interval, measured in bits.

Time Interval (Tc) – identifies the time interval for each burst, measured in seconds or sometimes milliseconds.

The CIR is calculated using the formula:
CIR (bps) = Bc (bits) / Tc (seconds)

With a token bucket system, the bucket is filled with tokens, and each token represents one byte. Thus, to transmit a 50-byte packet, the bucket must  contain a minimum of 50 tokens. Tokens are consumed as traffic is  transferred, and the bucket is refilled with tokens at the speed of the CIR. If the bucket is full, then excess tokens will spill out and are wasted.

The capacity of the bucket is defined by the burst rate. If the data (in bytes) to be transmitted is less than the number of tokens currently in the bucket, then the traffic is conforming to the policy and is (usually) forwarded.

If the data (in bytes) to be transmitted is more than the number of tokens currently in the bucket, then the traffic is exceeding the policy. This excess  traffic can be shaped (buffered) or policed (dropped or re-marked), depending on the configured policy.

The above describes a One Token Bucket system. Some SLA policies allow for bursts that are higher than the normal burst rate (Bc), during periods of non-congestion. This is referred to as the excess burst (Be) rate.

The excess burst rate is an optional configuration option, and is defined as a Two Token Bucket system. Excess tokens are not wasted, but are instead placed in an excess bucket. The capacity of this bucket is defined by the excess burst rate. Traffic that exceeds the normal token bucket can borrow tokens from the excess bucket – but will usually be dropped first during congestion. Traffic that exceeds the excess bucket is violating the policy.

No comments:

Post a Comment