Suspendable Requests for LAMP systems?
The traditional way of handling dynamically-generated Web content is to have the Web server use multiple threads, even keeping a thread pool. Then whatever program that generates the content acts as quickly as possible. As long as there are a lot of threads, they are available quickly (or pre-created) and the program does not take a long time to run (which is true for a lot of Web applications), this model works fine.
However, things are changing. People are using REST or SOAP Web services (e.g. Google APIs), AJAX, etc. AJAX has increased the number of simultaneous requests a lot. Web services, AJAX polling and Comet means that each request can potentially take a long time. Collectively, these requests can take up a lot of threads, creating a scaling bottleneck. Notice that these threads can spend a lot of time doing nothing (i.e. waiting for something else).
The upcoming Servlet 3.0 standard will support Suspendable Requests. Jetty, a Java Web server and servlet container, supports continuation that they claim is about the same thing. The principle is that if a dynamic Web program (JSP script, PHP script, etc.) has to wait for some event, the program can be put to sleep. Its thread is reclaimed by the Web server to serve other requests. When that event happens, the Web server wakes up the Web program and runs it in another thread.
On the other hand, I have not seen anything like this in PHP. A lot of systems are using Apache + MySQL + PHP setups, perhaps more than Java + Servlet setups. Does anyone know if there is anything like Suspendable Requests for LAMP systems?