Expand description
Per-host rate limiting and concurrency control Per-host rate limiting and concurrency control.
This module provides adaptive rate limiting for HTTP requests on a per-host basis. It prevents overwhelming servers with too many concurrent requests and respects server-provided rate limit headers.
Β§Architecture
- [
HostKey]: Represents a hostname/domain for rate limiting - [
Host]: Manages rate limiting, concurrency, and caching for a specific host - [
HostPool]: Coordinates multiple hosts and routes requests appropriately - [
HostConfig]: Configuration for per-host behavior - [
HostStats]: Statistics tracking for each host
ModulesΒ§
- config π
- headers π
- Handle rate limiting headers. Note that we might want to replace this module with https://github.com/mre/rate-limits at some point in the future.
- host π
- pool π
StructsΒ§
- Cacheable
Response π - The result of a HTTP request, used for internal per-host caching.
This abstraction exists, because
Responsecannot easily be cached since it does not implementClone. - Host
- Represents a single host with its own rate limiting, concurrency control, HTTP client configuration, and request cache.
- Host
Config - Configuration for a specific hostβs rate limiting behavior
- Host
Configs - Per-host configuration overrides
- HostKey
- A type-safe representation of a hostname for rate limiting purposes.
- Host
Pool - Manages a pool of Host instances and routes requests to appropriate hosts.
- Host
Stats - Record and report statistics for a
crate::ratelimit::Host - Host
Stats Map - A
HashMapmapping hosts to theirHostStats - Rate
Limit Config - Global rate limiting configuration that applies as defaults to all hosts
Type AliasesΒ§
- Client
Map - Keep track of host-specific
reqwest::Clients