M
M
Messi2017-05-05 09:53:55
Yii
Messi, 2017-05-05 09:53:55

How to speed up getting data from the API?

1. The user entered id .
2. I make a request to the API of another service with the id etip .
3. For example, I get the total number of records 19000.
Now I need to go through each record from these 19000, get the value of this record and then determine the maximum value from these 19000.
API for one request gives a maximum of 200 records.
I did this:
1. Loop for from 1 to 19000/200
2. For each pass of the loop, write the maximum value out of 200 to the array.
3. When the for has reached the end, select the maximum value from the written array.
Works but takes a long time.
How can this be improved or should it be done differently?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Fortop, 2017-05-05
@FitTech

If you can run API requests in parallel, then do so.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question