We have the following rate limiting algorithms.
By comparing the above algorithm and their cons / pros, we decide to use the token bucket algorithm for our rate limiter as it is easy implementation and able to handle burst traffic. In actual practice, the algorithm can be dynamic to fit different use cases.
userID: String
IpAddress: String
timestamp: DateTime
serviceName: String
The clients (web browser / mobile app) sends a request to rate limiter middleware.
the rate limiter middleware decides if the request should be limited
if limited, discard the request.
if not limited, pass the request to the API servers.
domain: auth
descriptor:
key: auth_type
value: login
rate_limit:
unit: minute
request_per_unit: 5
Two problems:
Explain any trade offs you have made and why you made certain tech choices...
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?
Hard rate limiting vs soft rate limiting: