Curl multiple processes cycle http requests take up a lot of cpu, how to optimize it

when PHP uses queues to send text messages and mail in batches, curl http loops request Ali takes up a lot of cpu when the request Ali is larger than the interface, resulting in slow website access. In this case, how to optimize it


curl request sets timeout, response time, and discards if the time is too long.
and. The number of concurrent requests can be less at the same time. If you now have 100 text messages waiting to be sent in the library, you can't take them out at once and then foreach the loop. You can take 10 at a time. And then deal with it. After processing, pick it up again and send it again. This way of thinking. You can try it. The same is true of e-mail.


curl_multi_init processes batch cURL in parallel
http://php.net/manual/zh/func.

Multi-threaded CURL, is very suitable for your current batch processing scenario.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35815-e4eb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35815-e4eb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?