This algorithm can be implemented using two separate approaches:
Calculating a rolling average (Requests in current window + requests in the previous window * overlap percentage of
the rolling window and previous window)
Pros:
This smooths out spikes in traffic since rate is based on average rate of previous window
memory efficient
Cons:
Works for not-so-strick lookback window.
Approximation of the actual rate (maybe only 0.003%) of requests incorrectly limited.
This algorithm can be implemented using two separate approaches:
Calculating a rolling average (Requests in current window + requests in the previous window * overlap percentage of the rolling window and previous window) Pros:
https://medium.com/@saisandeepmopuri/system-design-rate-limiter-and-data-modelling-9304b0d18250