Hanging request ram issue
I would like to provide a PHP hanging request that will stay open until new events exists, at which point it will immediately return back JSON encoded data to javascript client.
Connection -> wait for events (check, sleep, check, sleep, etc) -> event is detected -> send events back -> close reques开发者_JAVA技巧t.
CPU load is no issue with this configuration, but the amount of RAM required to scale is about 5-10MB per user because each connection requires 1 PHP proc. Is there a way to allow a single PHP process to be used to server more than 1 connection at the same time. Also is it possible to do this without using some type of listening daemon service?
it's for an interactive game, that requires close to real time responses, and polling every .5-2 seconds is going to use even more resources than a hanging request
In this case PHP is definitely is NOT a solution to your problem. Consider something like C++, Delphi or .NET to write a webservice. You are trying to eat soup using a fork...
精彩评论