M
M
Maxim E2017-02-26 13:26:52
PHP
Maxim E, 2017-02-26 13:26:52

Specific RDS (requests per second) in queue server?

At the moment there is a Gearman server, several servers with 20 workers each.
Workers make requests via curl to a specific address (3rd party external API).
Question two:
How to limit the number of requests per second by all workers? To not send more than 100 requests per second from all workers to a specific address.
How to limit the number of requests per second by workers on a specific server? If each server has one IP, then limit sending requests from one IP to a third-party API.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kiyashko, 2017-02-26
@creativeworm

Of course, this cannot be done by means of Gearman - this is clearly an external task in relation to gearman.
The main idea is to run the entire flow through some kind of regulator.
How would I do.
1) there is a master worker that adds tasks to the queue server for a request to an external API
2) clients queue not tasks for a request to an external API, but tasks for a request to this same master worker
3) a master worker, having received a task , checks if the flow is exceeded, and if it is exceeded, waits, not exceeded - queues a task for a request to an external API

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question