Firecracker.RateLimiter (firecracker v0.1.0)
View SourceA data-only representation of an I/O rate limiter in Firecracker.
Firecracker implements a token bucket-based rate limiter for controlling both I/O bandwidth and operations frequency. Rate limiting can help prevent resource contention and ensure consistent performance when running multiple Firecracker instances.
The rate limiter has two main components:
:bandwidth- Controls data transfer rates (bytes per second):ops- Controls operations frequency (operations per second)
Both components use a token bucket algorithm where tokens are consumed for each operation and are replenished at a configured rate. Each bucket can be configured with:
:size- Maximum number of tokens the bucket can hold:refill_time- Time in milliseconds between token refills:one_time_burst- Additional tokens allowed for initial burst
Summary
Functions
Configures the given rate limiter to rate limit bandwidth with the given configuration.
Creates a new I/O rate limiter.
Configures the given rate limiter to rate limit ops with the given configuration.
Types
Functions
Configures the given rate limiter to rate limit bandwidth with the given configuration.
Options
:size- Maximum number of tokens (bytes) in the bucket:refill_time- Time in milliseconds between token refills:one_time_burst- Additional tokens allowed for the initial burst
Creates a new I/O rate limiter.
Options
:bandwidth- Configuration for bandwidth rate limiting (bytes/second):size- Maximum number of tokens (bytes) in the bucket:refill_time- Time in milliseconds between token refills:one_time_burst- Additional tokens allowed for the initial burst
:ops- Configuration for operations rate limiting (operations/second):size- Maximum number of operations tokens in the bucket:refill_time- Time in milliseconds between token refills:one_time_burst- Additional tokens allowed for the initial burst
Configures the given rate limiter to rate limit ops with the given configuration.
Options
:size- Maximum number of operations tokens in the bucket:refill_time- Time in milliseconds between token refills:one_time_burst- Additional tokens allowed for the initial burst