Implementing Real-time Dynamic Rate Limiting for APIs using Nginx + Redis

Rate limiting is a critical technique in System Design that controls the frequency of requests sent to the Server. For a client, we implemented modified, dynamic version of Rate limiting and this is the architecture we used.

Rate limiting is a critical technique in System Design that controls the frequency of requests sent to the Server. It is essential for:

  • Preventing System Overload

  • Mitigating malicious attacks, such as DDoS

and mostly these can be accomplished using Static rate limiting.

But I was recently working with a client where we need to do Rate limiting dynamically based on the user’s purchased plan and Admin settings for that client.

Here is the simplified, working version of the Sliding Window protocol implemented using Redis — Github Link