Meaning
Traffic shaping and rate limiting in network devices often utilize an algorithm that controls data flow by allowing bursts while maintaining a long-term average transfer rate. This algorithm, known as the token bucket, regulates packet transmission based on the availability of tokens in a virtual reservoir. Refilling occurs at a constant rate up to a predefined maximum capacity.
Network interfaces employ this algorithm to enforce quality of service policies.
Rate Limiting
Burst capacity is determined by the size of the virtual reservoir. When a token bucket receives a burst of packets, it transmits them immediately as long as there are enough tokens. Each transmitted packet consumes a specific number of tokens.
Once the reservoir is empty, subsequent packets are queued or discarded until more tokens are generated.
Algorithm Mechanism
Configuring the refill rate determines the long-term average bandwidth allowed through the interface. The token bucket parameters must be tuned to match the subscription plan or hardware capabilities. This tuning involves balancing the bucket size and the refill rate to allow transient bursts without causing network congestion.
System Integration
Network switches and operating system kernels integrate this algorithm to manage traffic at the boundary where different networks connect. Utilizing a token bucket helps smooth out the traffic flows. The final assembly ensures stable network performance under varying loads.