I have 1 api key that has a rate limit 1000req/1min.

I would like to somehow use 50% of that limit in service 1 and 50% of that limit in service 2. Let's say they're just 2 separate processes using the same api key. How could I implement distributed rate limiter like that?


  • 1
    Why not just throttle each service so that on average each one sends no more than 500 per minute? A simple Thread.sleep(...) in between requests is a good place to start. Oct 28, 2021 at 12:28
  • That was my initial thought just asked this because wasn't sure if I'm on the right track of approaching this problem. Ty.
    – Konrad
    Oct 28, 2021 at 12:44
  • 3
    It really depends if you will always have 2 services or if you dynamically spin services based on demand. If this simple approach doesn't work in practice, you may need to set up a queue and have a single service that pops off the queue to make those requests at the correct rate. Oct 28, 2021 at 13:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy