Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

Simple shaping

Hi guys, I have some problem with shaping. My aim is to shape certain traffic. The show output about the config is below

 

show policy-map interface gigabitEthernet 0/0
GigabitEthernet0/0

Service-policy output: POLICE_TEST

Class-map: CLASS_TEST (match-all)
44295 packets, 45196160 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: access-group 100
Queueing
queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/39664/0
(pkts output/bytes output) 4631/1026740
shape (average) cir 8000, bc 32, be 32
target shape rate 8000

Class-map: class-default (match-any)
1467 packets, 1048542 bytes
30 second offered rate 0 bps, drop rate 0 bps
Match: any

queue limit 64 packets
(queue depth/total drops/no-buffer drops) 0/0/0
(pkts output/bytes output) 1467/1062962

 

As you see I have shaped the traffic with 8kbps. Having doing that It calculated bc value as 32. There is a formula which can be used to calculate Tc(Time interval). Tc = Bc / CIR. According to this formula Tc would be 4ms. if I am not wrong this means that each 4ms it would send 32 bit. When I ping a router which is connected to the shaped interface, it's round-trip time average would be 2 ms. Should not It be above 4ms. Thanks for your answer.

Everyone's tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Super Bronze

DisclaimerThe Author of this

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

I recall (?) Bc should be large enough to cover maximum packet size.  If correct, one reason for that, you cannot send parts of a frame/packets.

 

Also, with Ethernet, minimum size is 64 bytes.  But let's assume your packet size is only 8 bits, and we have six of them, back-to-back, and line speed is 64 Kbps.

 

First packet arrives, current allowance for first Tc is your 32 bits, so it is transmitted. Second packet arrives, current allowance for first Tc is now 24 bits, so it too is transmitted.  3rd and 4th are transmitted too.

 

When the 4th packet is transmitted, your allowance is now zero.  So the 5th and 6th packets are queued until the next Tc period when your allowance is reset to 32 bits.  But how long are they held?

 

Well the first 4 packets, combined 32 bits, were transmitted at 64 Kbps, which takes 32 / 64000 = .5 ms.  So the introduced delay, before the 5th packet begins to be transmitted is 4 ms - .5ms = 3.5 ms.  The 5th and 6th packets only take another .25ms to transmit.

 

So, to recap, your first 4 packets were transmitted in .5 ms, although your CIR is 8 Kbps.  All 6 packets, though, took 4.25 ms to transmit.

 

As only 32 bits, per 4 ms are allowed to be transmitted, your long term average is maintained, but individual 8 bit packets are still transmitted at wire-speed.

 

Now for even more fun, lets assume your first 8 bit packet arrives 3.5 ms into the first Tc period.  The first 4 packets are transmitted, the Bc is reset at the 4 ms interval, and so the 5th and 6th packets are immediately transmitted.  So, all 6 packets are transmitted, back-to-back, in .75 ms, i.e. none were delayed!

 

PS:

BTW, the above doesn't address shapers that carry unused Bc credits.

 

Suppose the first packet arrives just at the end of the first Tc and the rest of that period wasn't used.  So although the next 5 packet have 40 bits to transmit, and a Tc only provides 32 bits per Tc, if we add in the "unused" credit of 24 bits from the first period, we could transmit the 6th packet w/o delay too.  Again, all six 8 bit packets would be transmitted at wire speed, w/o any additional delay!

4 REPLIES
Super Bronze

DisclaimerThe Author of this

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

Perhaps you slightly misunderstand how a shaper shapes.

 

When shaping, bits/frames/packets are always transmitted at wire-speed.  What a shaper does, it "measures" aggregate transmission volume (Bc), not transmission rate, during the Tc.  If the volume hasn't been exceeded, the packet is allowed to be transmitted.  If the volume has been exceeded, the packet is queued.

 

So, a small ping packet might often just go full wire-speed.  Even if the shaper queues a ping, depending on the IOS version, some shapers internally use WFQ, so a ping packed could jump to the head of a congested shaper.

New Member

Hi Joseph, I seem to be

Hi Joseph, I seem to be confused. According to the configuration above, let's imagine the router gets a  packet that is 74 bits. According to the formula Tc=4ms, Bc=32 bits and Cir=8000 bits. During the first Tc period(4ms) it sends 32 bits and waits for first Tc period to be finished. After the period has  finished it sends another 32 bits and waits for the second Tc to be finished. Lastly it sends 10bits. What I understand is that it sends totatly paket at least 8ms. Is it right? Can you confirm it? Thanks. 

Super Bronze

DisclaimerThe Author of this

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

I recall (?) Bc should be large enough to cover maximum packet size.  If correct, one reason for that, you cannot send parts of a frame/packets.

 

Also, with Ethernet, minimum size is 64 bytes.  But let's assume your packet size is only 8 bits, and we have six of them, back-to-back, and line speed is 64 Kbps.

 

First packet arrives, current allowance for first Tc is your 32 bits, so it is transmitted. Second packet arrives, current allowance for first Tc is now 24 bits, so it too is transmitted.  3rd and 4th are transmitted too.

 

When the 4th packet is transmitted, your allowance is now zero.  So the 5th and 6th packets are queued until the next Tc period when your allowance is reset to 32 bits.  But how long are they held?

 

Well the first 4 packets, combined 32 bits, were transmitted at 64 Kbps, which takes 32 / 64000 = .5 ms.  So the introduced delay, before the 5th packet begins to be transmitted is 4 ms - .5ms = 3.5 ms.  The 5th and 6th packets only take another .25ms to transmit.

 

So, to recap, your first 4 packets were transmitted in .5 ms, although your CIR is 8 Kbps.  All 6 packets, though, took 4.25 ms to transmit.

 

As only 32 bits, per 4 ms are allowed to be transmitted, your long term average is maintained, but individual 8 bit packets are still transmitted at wire-speed.

 

Now for even more fun, lets assume your first 8 bit packet arrives 3.5 ms into the first Tc period.  The first 4 packets are transmitted, the Bc is reset at the 4 ms interval, and so the 5th and 6th packets are immediately transmitted.  So, all 6 packets are transmitted, back-to-back, in .75 ms, i.e. none were delayed!

 

PS:

BTW, the above doesn't address shapers that carry unused Bc credits.

 

Suppose the first packet arrives just at the end of the first Tc and the rest of that period wasn't used.  So although the next 5 packet have 40 bits to transmit, and a Tc only provides 32 bits per Tc, if we add in the "unused" credit of 24 bits from the first period, we could transmit the 6th packet w/o delay too.  Again, all six 8 bit packets would be transmitted at wire speed, w/o any additional delay!

New Member

Thank you very much Joseph.

Thank you very much Joseph. It is really helpful.

168
Views
5
Helpful
4
Replies
CreatePlease to create content