Dropbox | Rate Limiter

In an interval of 10 seconds more then 10 request comes from a specific client the 11th, 12th, requests will get blocked until 10 seconds from the first request will pass and then a new time windows of 10 seconds will be open. the idea is no more than 10 requests per 10 secs.

The time frame starts on each client’s first request and ends 10 seconds later.

I want to implement this logic on the server. Which data structures/collection/custom made object would you build to implement such a logic...

it is also important to have a thread-safe solution and performance is also a factor here..

Comments (2)