Not long ago, there was one sane model for running web applications in PHP: handle one simultaneous request per process, build everything up at the beginning of the request, tear everything down at the end, and block on I/O everywhere along the way. That’s still the standard for PHP web applications. But with advances in the PHP runtime…and new concurrency frameworks like Icicle and AMPHP on top of those new features…PHP applications can behave a bit more like Node.js ones, with the application itself serving web requests…and outlasting them…interleaving multiple concurrent requests via async I/O. Those advances can pack more performance into a given application, handling more requests per second and taking less time per request than a more traditional setup.
We’ll take a look at the basic concepts powering this new wave of async frameworks (generators!), then dive into how you’d build an application that runs on top of those frameworks, including an example app that showcases what async I/O can do to shorten response times and squeeze more requests per second out of an all-elsse-equal hardware and software setup.