Computer Network Traffic Shaping

From Computing and Software Wiki

Jump to: navigation, search

Traffic shaping (also referred to as packet shaping) is the technique of delaying and restricting certain packets traveling through a network to increase the performance of packets that have been given priority. Classes are defined to separate the packets into groupings so that they can each be shaped separately allowing some classes to pass through a network more freely than others. Traffic shapers are usually placed at the boundaries of a network to either shape the traffic going entering or leaving a network. Traffic shaping does not actually speed up a networks total thoughput. It is a tool used to help manage a network's resources.

A Leaky Bucket implementation of Traffic Shaping[1]



Leaky bucket

A leaky bucket is a fifo buffer used to store incoming/outgoing traffic. It then leaks out packets at a set rate slowing down incoming or outgoing traffic to a desired rate. For different classes separate fifos are used to store the incoming packets. Each bucket is set to leak out packets at different rates allowing some classes to have a higher throughput than other classes. When excessive traffic causes the buffer to overflow additional incoming traffic can either be lost, or even let through. A Random Early Discard algorithm may may also be used to deal with overflow.

Token Bucket

A Token Bucket implementaion[2]

A Token bucket is Similar to a Leaky bucket except that it uses tokens which are added to the bucket at a set rate r. At most n tokens can be stored in the bucket. Packets are allowed to pass through the bucket only if there are enough tokens in the bucket to allow it. Tokens are removed from the bucket as traffic is allowed to pass through. Like a Leaky Bucket Token Bucket only lets traffic through at a set rate r overall, the difference is that Token bucket allows burst speeds of up to n can occur if tokens are allowed to accumulate in the bucket.

Costs and Benefits

A comparison of Shaping versus Policing[3]

One of the disadvantages with traffic shaping is that it usually doesn't take into account availability of network resources. Since the throughput of network traffic is fixed it won't make use of additional bandwidth if its available.

Traffic shaping can also make network traffic more consistent when it tends to come in bursts. That is when traffic exceeds a set rate it is stored in a buffer. This is unlike Traffic Policing in which excessive traffic is lost.

Applying traffic shaping to improve network performance can be a cheaper solution than upgrading a network's hardware.


Traffic shaping is used to help organizations with centralized servers that are under heavy traffic manage their resources.

ATM's - Automatic Bank tellers are a good example where Traffic shaping is used. Here a Leaky Bucket algorithm to help manage traffic[4].

ISP's - Internet Service providers will use traffic shaping to classify packets that depend on good latency in one class and then provide lower latency to these packets. For example packets for VoIP and gaming will be in a class that provides better throughput. Thus more of the bandwidth is made available for these packets by slowing down traffic that does not depend on good latency. An example of traffic an ISP would want to throttle is that caused by Torrents. Torrents take up a considerable amount of an ISP's bandwidth. Often users have torrents running in the background so having this traffic slowed down causes little inconvenience.


1.Computer Desktop Encyclopedia: leaky bucket,

2. QoS Introduction, H3C Technologies Co., Limited.

3. Comparing Traffic Policing and Traffic Shaping for Bandwidth Limiting, Cisco Systems, Inc. Aug 10, 2005.

4. Traffic Shaping in an ATM Environment, Prabhakar T V1, Burkhard Stiller, Thomas Walter, nstitut für Technische Informatik und Kommunikationsnetze TIK ETH Zürich, Gloriastrasse 35, CH – 8092 Zürich, Schweiz

See Also


Network-Based Software Architectures

Bandwidth Throttling

External Links

--Younga3 11:46, 9 April 2008 (EDT)Andrew Young

Personal tools