How to optimize the PHP asynchronous request to call the interface 20 times a second?

the current problem is:

send an ajax request as soon as you click the upload button. If there are 20 images, send ajax20 times. The PHP code calls Qiniuyun API, that is, Qiniuyun API is called 20 times a second, and the server explodes. Seek the optimization scheme.

Php
Mar.06,2021

send the request in a loop, wait for the last request to return successfully and then send the next request


when uploading the picture, upload, returns the url of the picture
finally submit submits the url to save


you can store all of it in the server. Then the server makes a queue, and there is a separate thread in the background to process the task of uploading the image to Qiniu. After the image processing is completed, the subsequent task is called back.
the front end displays similar words in the processing, then waits for the background processing to complete, and then modifies the foreground page.

Menu