LeetDezine
Deep Dives
Initializing search
    • Home
    • Start Here
    • Concepts
    • Back of Envelope
    • Foundation
    • Ascent
    • Expedition
    • Summit
    • Battleground
    • Home
    • Start Here
    • Concepts
    • Back of Envelope
    • Foundation
    • Ascent
    • Expedition
      • Rate Limiter
        • System Requirements
        • Deep Dives
          • Algorithms
          • Distributed Rate Limiting
          • Rule Storage
          • Fault Isolation
        • Final Design
        • Observability
    • Summit
    • Battleground
    1. Home
    2. Expedition
    3. Rate Limiter
    4. Deep Dives
    DD

    Rate Limiter · Deep Dives

    Deep Dives

    Four deep dives — algorithms from scratch, distributed enforcement, rule storage, and fault isolation including DDoS layered defence.

    Algorithms
    Fixed window, sliding window log/counter, token bucket, leaky bucket — built from scratch and compared.
    Token BucketLeaky BucketSliding WindowFixed Window
    Open →
    Distributed Rate Limiting
    Atomicity problem with naïve counters, Lua scripts for atomicity, and Redis cluster enforcement.
    Lua AtomicityRedis ClusterRace Condition
    Open →
    Rule Storage
    How rate limiting rules are stored, loaded into workers, and refreshed without restart.
    Rule DBConfig RefreshWorker Cache
    Open →
    Fault Isolation
    Rate limiter down, Redis down, Rule DB down, API gateway down, and DDoS layered defence.
    Redis DownFail OpenDDoS DefenceAPI GW
    Open →