Traffic shaping is a method of limiting the bandwidth going through an interface. Typically, traffic shaping will have a committed information rate (CIR) measured in bits/second (bps). For example, if you purchase a 100Mbps circuit, the CIR is 100,000,000 bps. With traffic shaping, any traffic that exceeds the average bit rate will be buffered, the size of the buffer is referred to as queue-limit in Cisco terms, but other vendors may call it something else. With traffic policing, any traffic that exceeds the average bit rate will be dropped or re-marked for discard eligibility, depending on how the policer is configured. Most Metro Ethernet providers will configure their policers to drop the traffic that exceeds the policer rate.
The average traffic shaping rate is achieved by sending small chunks of data at defined intervals. For example, say you are a baseball pitcher who can throw 10 baseballs per second (Bbps). You can achieve this rate in more than one way. If you throw 2 baseballs every 200ms (milliseconds), that will achieve 10 Bbps. Intervals of 200ms means there will be 5 intervals in one second (1000ms/200ms). Two baseballs times 5 intervals = 10 Bbps. Another way of achieving the same rate is to throw 5 baseballs every 500ms. This leaves us with 2 intervals in one second (1000ms/500ms). Five baseballs times 2 intervals = 10 Bbps.
In the first example our Tc = 200ms, our Bc = 2 baseballs and our CIR was 10 Bbps
In the second example our Tc = 500ms, our Bc = 5 baseballs and our CIR was 10 Bbps
- Tc = Time between throwing baseballs
- Bc = number of baseballs thrown
- CIR = average number of baseballs over one second
This example shows that we achieve the same average rate over one second whether we throw 5 baseballs every 500ms or 2 baseballs every 200ms; either way we will reach the same rate (10 Bbps).
In networking, we just replace the baseballs with bits.
The equation for traffic shaping: Tc = Bc/CIR
- Tc is measured in seconds
- Bc is measured in bits
- CIR is measured in bits/sec (bps)
First example: .200 seconds = 2 bits/10bps
Second example: .500 seconds = 5 bits/10bps
The image below illustrates this analogy. We can split up the baseballs in different ways to achieve the same rate over one second. We can send more baseballs (bits) less often or we can send fewer baseballs more often.