tags:

views:

33

answers:

1

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 request.

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?

+2  A: 

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...

FractalizeR
Thank you for restoring my faith in the world's sanity level.
Tim Post
That was my plan of attack, but I was hoping I could find a solution that work on a cloud hosting solution instead of a custom setup.
Kendall Hopkins