2

In general, both are implemented through token bucket algorithm. I am wondering how they are really implemented on hardware, i.e. ASIC or NPU chips.

Based on an online article I found from Cisco, Comparing Traffic Policing and Traffic Shaping for Bandwidth Limiting, it says the key implementation difference is how tokens are replenished.

==========================Shaping================================================

Quote:

Shaping increments the token bucket at timed intervals using a bits per second (bps) value. A shaper uses the following formula:

Tc = Bc/CIR (in seconds)

In this equation, Bc represents the committed burst, and CIR stands for committed information rate.

Question: Based on description, this sounds leaky buckets alg. to me, so

1) Is this implemented based on timer on hardware?

2) In the case of a huge number of shaping policies configured on the line card, I imagine this would result in a huge number of different Tc's. Would that affect performance?

3) A follow up to 2), another way to implement this that i can think of is, all the token buckets are updated with a fixed small enough interval, but each token buckets is updated with different tokens for each trigger. Is this a practical option?

=========================Policing=============================================

Quote:

In contrast, class-based policing and rate-limiting adds tokens continuously to the bucket. Specifically, the token arrival rate is calculated as follows:

(time between packets (which is equal to t-t1) * policer rate)/8 bits per byte

In other words, if the previous arrival of the packet was at t1 and the current time is t, the bucket is updated with t-t1 worth of bytes based on the token arrival rate

Question:

1) does this mean there is a time stamp kept? and for each packet, we do this calculation?

2) As I heard before, if different policing policies share the same rate and burst, they can share the same rate profile resource on the hardware, so it helps high scale configurations. With this formula above, how does this rate profile work? and how it is shared?

Thanks in advance,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.