The promise of asynchronous PHP
summary
Asynchronous PHP can run nonblocking IO using built‑ins and libraries so you can do DNS lookups, HTTP calls and file streams in parallel instead of serially. Examples include ReactPHP with event loops, deferred/promises and streams, a DNS resolver using Google DNS, a full chat server in ~30 lines, and lower level options like pthreads, pcntl_fork, popen and curl_multi_select. Caveats: it often uses more CPU, doesn’t guarantee execution order, and long tasks are better off in queues like Gearman.
AI-written summary · about
chapters (13)
- 0:00Introduction to Async PHP
- 2:04Understanding Blocking IO
- 5:52Built-in Async Solutions
- 7:05Pthreads for Multi-threading
- 9:53Multiprocessing with Fork
- 11:58Using Curl Multi
- 13:24Underlying Libraries
- 15:48Introduction to ReactPHP
- 19:06Promises and Chaining
- 27:03Stream Processing
- 29:10Building a Chat Server
- 31:46Golden Rules and Pitfalls
- 34:27Q&A and Conclusion
