Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate limiting API requests within multiple workers #26

Open
pdoreau opened this issue Jul 2, 2020 · 1 comment
Open

Rate limiting API requests within multiple workers #26

pdoreau opened this issue Jul 2, 2020 · 1 comment

Comments

@pdoreau
Copy link

pdoreau commented Jul 2, 2020

My use case is :

  • A set of 5 (rabbitmq) workers consume messages, doing one ore more API request per message
  • No more than 10 API requests should be globally (throughout all workers) done for 1 second

Would this repo implementation be fine with this distributed constraint ?
Would this rate of 10 be an absolute limit or an average ?

@tristanbailey
Copy link

If you use one of the DB or file Storage methods that all the workers can read from then it would work. As each would call from that. So decided where your workers are on same server, network, internet etc. I’ve used Redis for this before. (As each worker checks the same time left token, just think about how many workers and a time locking them if the timeout checking the worker kills it before it gets all its token use work done) — for this sometimes I have made more tokens with less quota for a group of workers, then say 2x5 workers with 10 token each might be better than 10 with 20 token. You need to test and see when all busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants