Re: PHP Suspendable requests for Apache
| From: | Rustam Abdullaev | Date: | Sun, 14 Sep 2008 20:53:27 +0000 |
| Subject: | Re: PHP Suspendable requests for Apache | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-40511@lists.php.net to get a copy of this message | ||
> Can you provide some scenario, when this is useful?
Server Push is an http hack that enables the server to send a message to the
client immediately, without the need for a client to poll the server.
Basically, the client makes an XMLHTTP request to which the server doesn't
answer immediately, but only answers when an event occurs, or when it times
out (then the client re-opens the connection).
Examples:
1. Chat rooms. It's nice to post new messages to the clients as soon as they
become available.
2. A Mail client can inform the user of new mail as soon as it arrives. (as
does gmail)
3. Long searches can return as soon as data is available, without polling
the server every n seconds.
More details here:
http://code.google.com/p/google-web-toolkit-incubator/wiki/ServerPushFAQ
Now., the problem is that valuable server resources are taken up by these
lingering connections:
1) A TCP Connection. The practical limit on these is ~100,000. Which is
pretty high. I could live with that.
2) The Server Thread. The limit is very low, on the order of ~100. That's
why it is very important to be able to release the server thread.
Hope this helps,
- Rustam -