Skip to main content

Module ratelimit

Module ratelimit 

Source
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

Structs§

Host
Represents a single host with its own rate limiting, concurrency control, HTTP client configuration, and request cache.
HostConfig
Configuration for a specific host’s rate limiting behavior
HostKey
A type-safe representation of a hostname for rate limiting purposes.
HostPool
Manages a pool of Host instances and routes requests to appropriate hosts.
HostStats
Record and report statistics for a crate::ratelimit::Host
HostStatsMap
A HashMap mapping hosts to their HostStats
RateLimitConfig
Global rate limiting configuration that applies as defaults to all hosts

Type Aliases§

ClientMap
Keep track of host-specific reqwest::Clients
HostConfigs
Per-host configuration overrides