M
M
Messi2017-06-27 16:52:00
Yii
Messi, 2017-06-27 16:52:00

How to make a large number of requests?

There are 1500 records in the database. You need to work with the API using the record data. That is, the API is tasked with getting data between two records 1 and 2, the next request is 1 and 3, 1 and 4, 1 and 1500, 2 and 1, 2 and 2, and so on, until there are 1500 and 1500.
It turns out that I have there will be 2,250,000 GET requests.
The API has a limit of 15,000 requests per day, and it's a long time to wait until such a number of requests are processed one at a time.
Is it possible to somehow send more than one condition in one request, or how can all this be optimized?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Volintsev, 2017-06-28
@FitTech

It seems to me that 2,250,000 HTTP requests is a very bad architecture. Not only will the server swell, but the client will not wait. One request, let's say 3ms (very optimistic, just perfect), then everything together will be 6750s or 112 minutes. Two hours of continuous chiselling on API without timeouts.
I propose to transfer the logic either to the client application (who wants to make 2M requests) or to the server (which should return 2M requests).
Or let the client receive 1500 records at once or in portions and analyze it on his own.
Or let the server prepare the data in the required form.
If you think that it’s not a master’s job for the server to do business intelligence, then develop an intermediate microservice that will receive 1500 records from the source service and prepare an upload in the desired format for the client. Three links.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question