Expand description
Rate limiting for enterprise workloads.
This module provides rate limiting capabilities for controlling request rates to GPU kernels and system resources, supporting both global and per-tenant limits.
ยงFeatures
- Token bucket and sliding window algorithms
- Per-tenant rate limiting
- Global rate limiting
- Configurable burst capacity
- Real-time statistics
ยงExample
โ
use ringkernel_core::rate_limiting::{RateLimiter, RateLimitConfig};
let config = RateLimitConfig::default()
.with_requests_per_second(100)
.with_burst_size(50);
let limiter = RateLimiter::new(config);
if limiter.check("tenant_1").is_ok() {
// Request allowed
}Structsยง
- Fixed
Window ๐ - Fixed window rate limiter state.
- Leaky
Bucket ๐ - Leaky bucket rate limiter state.
- Rate
Limit Config - Configuration for rate limiting.
- Rate
Limit Guard - RAII guard for rate-limited operations.
- Rate
Limiter - Global rate limiter.
- Rate
Limiter Builder - Builder for creating rate limiters.
- Rate
Limiter ๐Stats - Internal statistics counters.
- Rate
Limiter Stats Snapshot - Snapshot of rate limiter statistics.
- Sliding
Window ๐ - Sliding window rate limiter state.
- Tenant
Limiter ๐ - Per-tenant rate limiter entry.
- Token
Bucket ๐ - Token bucket rate limiter state.
Enumsยง
- Limiter
State ๐ - Internal limiter state.
- Rate
Limit Algorithm - Rate limiting algorithm to use.
- Rate
Limit Error - Errors that can occur during rate limiting.
Traitsยง
- Rate
Limiter Ext - Extension trait for acquiring guards.
Functionsยง
- shared_
rate_ limiter - Create a shared rate limiter.
Type Aliasesยง
- Rate
Limit Result - Result type for rate limiting operations.
- Shared
Rate Limiter - Thread-safe, shareable rate limiter.