Skip to main content

Module pacer

Module pacer 

Source
Available on crate feature std only.
Expand description

Token Bucket Pacer

Smooths out traffic bursts by enforcing a uniform send rate. Instead of socket.send() dumping N packets at once (causing router queue buildups), the pacer spreads packets uniformly over the RTT interval.

§Design

Uses a Token Bucket algorithm:

  • Tokens replenish at rate bytes per second
  • Each send consumes packet_size tokens
  • If no tokens are available, the send is delayed

The pacer operates in conjunction with the BandwidthEstimator which feeds the target rate. When BBR says “send at X MB/s”, the pacer enforces that rate.

Structs§

Pacer
Token Bucket Pacer