shape peak & shape average
The shape peak replenishes both Bc and Be tokens every Tc seconds, and allows for sending at higher sustained rate that depends both on the size of Bc and Be. If only the Bc tokens were replenished, the sustained rate would be
CIR = Bc/Tc
With both Bc and Be tokens being replenished in shape peak, the sustained rate is
CIR' = (Bc+Be)/Tc
Expressing Tc from the first equation yields Tc=Bc/CIR, and using it in the second equation yields:
CIR' = (Bc+Be) / (Bc / CIR)=(Bc+Be) * CIR / Bc = CIR * (1 + Be/Bc)
This is the speed as indicated in the Command Reference for the shape peak command:
http://www.cisco.com/en/US/docs/ios/qos/command/reference/qos_s1.html#wp1074988
The shape average replenishes only the Bc tokens every Tc seconds, and hence the sustained rate is simply CIR=Bc/Tc. After periods of longer inactivity, the burst may grow up to Bc+Be bytes but it is not sustainable.
To compare:
- The sustained rate in shape average is equal to CIR=Bc/Tc (the CIR is a part of the configuration command)
- The sustained rate in shape peak is equal to CIR'=CIR * (1 + Be/Bc) (the CIR is a part of the configuration command)
- Both models allow for bursting up to Bc+Be
In default configuration, Be=Bc, therefore with shape peak, the CIR'=CIR*(1+Bc/Bc)=CIR*(1+1)=2*CIR, i.e. the shape peak would result into shaping on a doubled sustained rate than the shape average command.
Refer to: https://community.cisco.com/t5/routing/qos-question-shape-peak-and-shape-average/td-p/1855641
Personally, I would not say that shape peak 64000 and shape average 128000 yield the same results. It has been correctly explained that the shape peak shapes at a higher rate because every Tc, there are Bc+Be tokens replenished into the token bucket, and thus, the overall traffic rate is
Real Shaping Rate = Configured Rate x (1 + Be/Bc)
This Real Shaping Rate of the shape peak can never be exceeded because you can never send more than Bc+Be bytes in an interval of Tc. Indeed, with default settings, Bc=Be, and thus the Real Shaping Rate is doubled. The shape peak essentially allows you to use both the committed and excess rate every Tc interval, and you therefore get sustained CIR+EIR rate.
The shape average replenishes only Bc tokens per Tc interval. Thus, the shape average 128000 allows you for sustained rate of 128 kbps. However, after a longer period of low activity, when you accumulate enough excess tokens, you can actually burst up to the Bc+Be rate. Again, with the default settings, Bc=Be and thus the bursting would go up to 256 kbps.
Therefore, the shape peak 64000 and shape average 128000 are not equal. The peak will shape consistently to 128 kbps, never more, and it will allow to consistently send traffic in excess of the CIR. The average will shape the traffic to 128 kbps, along with allowing bursts up to 256 kbps after periods of no or low activity. Clearly, the bursting in average would in this case exceed even the PIR configured by your provider.
Refer to:https://community.cisco.com/t5/routing/peak-vs-average-shaping/td-p/1581178
https://community.cisco.com/t5/routing/qos-question-shape-peak-and-shape-average/td-p/1855641