Concurrent HTTP

Concurrent HTTP Requests Without Blocking

For a page that calls several APIs, an ordinary PHP-FPM request needs no event loop: curl_multi ran three 0.8 s calls in 0.80 s in Making HTTP Requests with cURL, and a Guzzle 23,452 Pool (Guzzle, PSR-7 and PSR-18) does the same. In ReactPHP, React 7,897 \Http\Browser::get() returns a promise per request, React\Promise\all() combines them in input order, and React\Async\await() waits on a fiber; three calls to the slow endpoint took 0.51 s. AMPHP, next, needs no promises at all. Either way, cap the requests in flight, time out each one, and decide what the page shows when one fails.