How rate limiting strategies work
masterThis library provides four primary rate limiting strategies to handle different traffic patterns:
- Concurrent Requests: Limits the number of active, in-progress requests. Best for protecting resource exhaustion.
- Fixed Window: Resets the limit after a specific time interval (e.g., 100 requests every 1 minute). Simple but can allow bursts at window boundaries.
- Sliding Window: A more precise version of Fixed Window that tracks requests relative to the current timestamp, preventing bursts at window edges.
- Token Bucket: Allows for bursts up to a certain limit (
TokenLimit) while maintaining a steady average rate via periodic replenishment (TokensPerPeriodoverReplenishmentPeriod).