Re: PHP Suspendable requests for Apache

From: Date: Sun, 14 Sep 2008 20:56:13 +0000
Subject: Re: PHP Suspendable requests for Apache
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-40512@lists.php.net to get a copy of this message
On Sun, Sep 14, 2008 at 5:33 PM, Rustam Abdullaev <rustamabd@gmail.com> wrote:
Hi, Is anyone working on a suspendable request support in PHP when used as a module in Apache? Suspendable requests are great for supporting Server Push technology, but are currently only supported in Jetty and Tomcat. The API would be extremely simple, for example: suspend(string request_id, int timeout); - this would end the current request but keep the client connection open up to "timeout" seconds. resume(string request_id); - this would resume a suspended request by starting a new PHP request but reusing the same client connection that was previously suspended
Two ideas: First is, for a rough approach that works today: you can emulate this by polling from the suspended process by sleeping for, say, 400ms and checking a shared value for a flag whether to resume. Second and most important though, Apache isn't architected to handle long running processes inside a request, as it typically uses a limited pool of threads/processes to serve requests, if enough requests in the pool are held up suspended, it would prove heavily detrimental to the server performance (this is why "push" technologies like Comet are not recommended on Apache). I would possibly suggest the requests communicating with (for example), long running background processes running from shell from that purpose, using standard interprocess communication like unix sockets.

« previous php.internals (#40512) next »