Traffic Shaping - Knowledge Base https://sites.google.
com/site/amitsciscozone/home/qos/traffic-shaping
Knowledge
Base
Home
Traffic Shaping
Wiki
ARP
BGP
Traffic Shaping involves in queueing traffic rather than
dropping it.
CEF
Data Center
Traffic Shaping terminology-
GPON
GRE Tc - Time interval (in milliseconds) over which the
ICMP committed burst (Bc) can be sent. Tc = Bc/CIR
IP Multicasting
Bc - Committed burst size (in bits). This is the amount of
IPv6
traffic that can be sent over an interval Tc
IS-IS
Juniper-JUNOS CIR - Committed Information Rate (in bits per second). The
L2VPN rate defined in the traffic contract
LAN
Shaped Rate - The rate at which a particular traffic is
Link Aggregation
shaped. It could be same as CIR or higher than CIR.
LTE Notes
MPLS Be - Excess burst size (in bits). This is the number of bits
NAT that can be sent beyond Bc
OAM
OSPF
PBB
PPP
QoS
Security
Traffic Engineering
VPLS
VPN
1 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
Attachments A Cisco router divides 1 second into multiple sub-seconds.
Above, 1 second is divided into 8 intervals (125ms each). Each
interval is called Tc. During each Tc, the router sends a burst
of traffic which is called Bc.
For example, to achieve a CIR (contract rate) of 128Kbps, the
Cisco router will send 16000 bits (Bc = 128000 * 0.125)
during the first interval and stop sending any further traffic
until the next interval. So, if the access link speed is
1.544Mbps, it will take the Cisco router 10.3ms to send 16000
bits. For the rest of the interval, it will not send any traffic.
Traffic Shaping with no Excess Burst:
Traffic shaping involves the concept of Token Bucket. In the
token bucket scenario, each token lets you send 1 bit. The size
of the token bucket is Bc. There are two actions that revolve
around token bucket and the tokens-
1. Re-filling of bucket with new tokens
2. Consumption of tokens by the Shaper to earn the right
to send packets
At the beginning of each Tc interval, the token bucket is filled
with tokens, but no more than Bc. If there is not enough room
in the bucket as the tokens were not used up in the previous
interval, some tokens spill out. Those spilled tokens cant be
used.
Every time a packet is sent, the Shaper spends tokens from
the bucket to buy the right to forward the packet. When the
Shaper tries to send the packet, and there are not enough
tokens in the bucket, the Shaper must wait until the next
interval when the bucket is refilled.
In Cisco IOS, traffic shaping with no excess burst can be
configured using shape average <shaping-rate> command
from policy-map configuration mode. The "shaping-rate" could
be same as CIR or slightly higher than CIR but less than
access-link rate.
The following example shows the configuration of average
traffic shaping. Traffic shaping is applied to outgoing TCP traffic
generated via Iperf.
2 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
Traffic shaping with no excess burst
class-map P5001
match access-group 101
!
policy-map SHAPE
class 5001
shape average percent 50
!
interface fastethernet 0/1
bandwidth 1000
service-policy output SHAPE
!
Cisco recommends only the shaping rate should be specified
and the inbuilt algorithm will calculate appropriate Bc. Cisco
IOS chooses Tc=24ms here. The Bc is calculated as 12000 bits.
The Increment value indicates the number of tokens
replenished every Tc interval. Also note, the Shaping Active
suggests no shaping. The reason being if there is no traffic
flowing through the interface, shaping will not be in effect. The
Byte Limit indicates the size of the token bucket.
output
Router# show policy-map interface fastethernet 0/1
FastEthernet0/1
Service-policy output: SHAPE
Class-map: P5001 (match-all)
5368 packets, 7598188 bytes
5 minute offered rate 99000 bps, drop rate 0 bps
Match: access-group 101
Traffic Shaping
Target/Average Byte Sustain Excess
Interval Increment
Rate Limit bits/int bits/int
(ms) (bytes)
50 (%) 0 (ms) 0 (ms)
500000/500000 3000 12000 12000
24 1500
Adapt Queue Packets Bytes Packets
Bytes Shaping
3 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
Active Depth Delayed
Delayed Active
- 0 5367 7597242 5343
7587026 no
Class-map: class-default (match-any)
457 packets, 33974 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
When Iperf was initiated to generate TCP traffic with 4
different flows, the maximum throughput it could achieve was
481kbps (~500kbps). This is almost equal to the shaping rate
500kbps.
Iperf output
C:\>iperf -c 192.168.2.10 -p 5001 -P 4 -t 60
------------------------------------------------------------
Client connecting to 192.168.2.10, TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[1912] local 192.168.1.10 port 1053 connected with
192.168.2.10 port 5001
[1880] local 192.168.1.10 port 1054 connected with
192.168.2.10 port 5001
[1864] local 192.168.1.10 port 1055 connected with
192.168.2.10 port 5001
[1848] local 192.168.1.10 port 1056 connected with
192.168.2.10 port 5001
[ ID] Interval Transfer Bandwidth
[1864] 0.0-60.5 sec 888 KBytes 120 Kbits/sec
[1848] 0.0-60.9 sec 896 KBytes 120 Kbits/sec
[1880] 0.0-61.2 sec 904 KBytes 121 Kbits/sec
[1912] 0.0-61.2 sec 904 KBytes 121 Kbits/sec
[SUM] 0.0-61.2 sec 3.51 MBytes 481 Kbits/sec
Traffic Shaping with Excess Burst:
Traffic shaping implements Be by making the token bucket
bigger; of the size of (Bc + Be). There are now Bc+Be worth of
tokens in the bucket. Still, at the start of each interval Tc, the
Shaper fills the bucket with Bc amount of tokens. However, if
due to inactivity during some interval (like in figure 1 above),
4 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
the bucket can accommodate those Bc worth of tokens since its
size has been increased. Now, in the next Tc interval, if there
are more bits to send, the Shaper can use these Bc+Be tokens
to send that amount of bits. In essence, exceed the shaping
rate as long as there are extra tokens left in the bucket.
The diagram below shows that since there was no activity
during fifth Tc interval, the Shaper used up those extra tokens
and sent Bc+Be worth of bits in the sixth interval.
Shaping at Peak rate:
With shape peak, CB shaping allows Bc+Be bits to be sent
every interval even if there has been no period of inactivity.
The Shaper replenishes Bc+Be tokens into the bucket.
In Cisco IOS, peak traffic shaping can be configured using
shape peak <shaping-rate> command from policy-map
configuration mode.
The following example shows the configuration of peak traffic
shaping. Traffic shaping is applied to outgoing TCP traffic
generated via Iperf.
peak traffic shaping
class-map P5001
match access-group 101
!
policy-map SHAPE
class 5001
shape peak percent 50
!
interface fastethernet 0/1
5 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
bandwidth 1000
service-policy output SHAPE
!
Again, the Cisco IOS calculates the appropriate Bc and Be
values. It uses Tc=24ms.
Router output
Router# show policy-map interface fastethernet 0/1
FastEthernet0/1
Service-policy output: SHAPE
Class-map: P5001 (match-all)
5335 packets, 7555414 bytes
5 minute offered rate 95000 bps, drop rate 0 bps
Match: access-group 101
Traffic Shaping
Target/Average Byte Sustain Excess
Interval Increment
Rate Limit bits/int bits/int
(ms) (bytes)
50 (%) 0 (ms) 0 (ms)
1000000/500000 3000 12000 12000
24 3000
Adapt Queue Packets Bytes Packets
Bytes Shaping
Active Depth Delayed
Delayed Active
- 0 5334 7554468 5317
7550502 no
Class-map: class-default (match-any)
170 packets, 12700 bytes
5 minute offered rate 0 bps, drop rate 0 bps
Match: any
The Iperf output shows that the maximum throughput
achieved this time is almost double than average shaping rate.
Iperf output
C:\>iperf -c 192.168.2.10 -p 5001 -P 4 -t 60
6 of 7 9/29/2012 7:08 PM
Traffic Shaping - Knowledge Base https://sites.google.com/site/amitsciscozone/home/qos/traffic-shaping
------------------------------------------------------------
Client connecting to 192.168.2.10, TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
[1912] local 192.168.1.10 port 1061 connected with
192.168.2.10 port 5001
[1880] local 192.168.1.10 port 1062 connected with
192.168.2.10 port 5001
[1864] local 192.168.1.10 port 1063 connected with
192.168.2.10 port 5001
[1848] local 192.168.1.10 port 1064 connected with
192.168.2.10 port 5001
[ ID] Interval Transfer Bandwidth
[1864] 0.0-60.4 sec 1.73 MBytes 240 Kbits/sec
[1880] 0.0-60.5 sec 1.73 MBytes 240 Kbits/sec
[1912] 0.0-60.5 sec 1.73 MBytes 240 Kbits/sec
[1848] 0.0-60.5 sec 1.73 MBytes 240 Kbits/sec
[SUM] 0.0-60.5 sec 6.93 MBytes 960 Kbits/sec
Sign in | Report Abuse | Print Page | Remove Access | Powered By Google Sites
7 of 7 9/29/2012 7:08 PM