Saturday, January 16, 2010

Shaper granularity on ME-3400 demystified

Everyone using ME-3400 switches might have noticed the following error message when trying to configure an output policy-map under an interface:


QoS: Configuration failed. The configured rate 4000000 bps is not
achievable in hw within 1% of configuration.
Closest value(s) are: 11111120 bps, 5882368 bps


Cisco documentation is cryptic (as always) about the details of this, but it has to do with some hardware limitation of this specific platform. In particular the granularity of the hardware for the shaping action is somehow based on pre-configured values.

The ME-3400 (as most lower end switches) has physical memory buffers, which can be used by IOS only in bunches of specific (pre-configured) sizes. In routers and high end switches, QoS is usually implemented in software through the use of memory pools, which allows the IOS to use parts of buffers with variable sizes.

Egress shaping on ME-3400 comes into two categories : Port shaping and Class-based shaping. Port shaping applies to all traffic passing through an interface, while class-based shaping applies to specific classes of traffic leaving an interface. Each one of them is using a different formula in order to give you all the supported values.

Port shaping values are based on the following formula:

(1 - 16

N
) * IfSpeed



Where:
N is a value between 17 and 64000
IfSpeed is the interface speed : 10 Mbps, 100 Mbps, 1 Gbps
The result in then rounded up to a multiple of 16.
An equivalent excel formula would be : CEILING((1-16/N)*IfSpeed;16)

Class-based shaping values are based on the following much simpler formula:

1

N
* IfSpeed



Where:
N is a value between 1 and 15625
IfSpeed is the interface speed : 10 Mbps, 100 Mbps, 1 Gbps

You can see some possible values in the table below:



According to the above table, in the port shaper the low end granularity is very coarse and the high end granularity is very dense, while the opposite happens in the class-based shaper. So there is no possibility you can have a <58 Mbps port shaper for 1 Gbps interfaces, as there is no possibility to have <5,8 Mbps port shaper for 100 Mbps interfaces. Similarly you can't have a 700 Mbps class-based shaper on a 1000 Mbps interface, nor a 80 Mbps class-based shaper on a 100 Mbps interface.

Let's take for example the following policy-map configuration which is applied on a 1 Gbps interface.


policy-map CHILD
class TEST-CLASS
shape average 100000
policy-map PARENT
class class-default
shape average 930000000
service-policy CHILD

If you try to change the shaper of the child class to a value >500 Mbps, you'll get a warning like the following:

3400(config-pmap-c)#shape average 700000000
QoS: Configuration failed. The configured rate 700000000 bps is not achievable in hw within 1% of configuration.
Closest value(s) are: 930000000 bps, 500000000 bps


If you check the formula for the class-based shaper (or have a quick look at the table), 930000000 is not actually a valid value to configure, but it gets printed because this is the limit imposed by the parent class. You just have to ignore it.

If you need specific values you might want to try changing the speed of the interface : choosing between 10/100/1000 should be easy for BaseTX interfaces, while 100/1000 Mbps SFPs exist for the SFP-based ones.

Also, it's strongly recommended that you disable port speed autonegotiation when you attach an output policy map to a 10/100/1000 port, to prevent the port from autonegotiating to a rate that would make the output policy map invalid.

Keep in mind that ME-3400E (the new enhanced version of ME-3400) implements a improved version of Egress Shaping Granularity, which uses a simpler linear formula. It's 64 Kbps for the class-based shaper and 100/500/1000 Kbps for the 10/100/1000 Mbps port-based shaper (100 Kbps for 10 Mbps ports, 500 Kbps for 100 Mbps ports, 1000 Kbps for 1000 Mbps ports).

4 comments:

  1. thanks for such close information.

    ReplyDelete
  2. thank you so so much! I was able to get my proper shaping BW adjusting the ifSpeed (too bad to tell the client to change their lan speed too...)

    ReplyDelete
  3. I'm new to this platform. I want to 512kbps on port. Please tell me the configuration. thanks in advance.

    ReplyDelete
  4. mhasan, you need to choose a port speed that enables you to use 512kbps for a class, according to the algorithm provided above.

    ReplyDelete

 
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Greece License.