Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in running a web service, that while I could implement via traditional AJAX, it would be better served with a more continuous stream of data, such as long polling or Comet stuff.

I understand that Comet effectively requires a process per connection on the server end, but I'm wondering if I set something up via nginx's HTTP Server Push type setup, whether I'd be able to run the backend on PHP through FastCGI and not get into too many hassles with many many PHP connections being needed at once. I'm aware that most users don't look too highly on PHP for Comet because of its general binding of 1 connection to 1 PHP process, but I'd like to avoid moving languages at this point.

If it's relevant and it helps, the application isn't a chat type application but something akin to Google Apps where multiple users can work on a single document, and I want to be able to show changes as close to realtime as possible to other users in the same document.

Thanks in advance :)

share|improve this question
up vote 0 down vote accepted

For starters, its a much better approach than apache when using the nginx push module

I have maintained 30k test connections on 1 server using this, by sending long polling to the push module and other requests to php..

Keep in mind working with websockets as browsers continue to be upgraded to support it..

Hope this helps

share|improve this answer
That is how I was reading it; that I create channels for the individual clients, and use an asynchronous (i.e. regular AJAX) request when a user makes an update, that goes off to PHP via FastCGI, which then republishes it to the appropriate channel(s). Awesome, thank you for confirming what I thought :) – Arantor Nov 8 '10 at 0:50
No problem.. Exactly what you said sounds right Just remember to publish to the comet module (for scalability if you need 100k connections invest a little time in a jobqueue also) application ---Publish--> Nginx Module <-----Listening----Client So when the update occurs have your php publish/push to the comet module on the right channel and let the module do its work :D – Arenstar Nov 8 '10 at 0:58

Take a look at It's a very scalable Comet server (+1M users from an entry-level server) and has PHP server side integration.

share|improve this answer
Thanks for the link, but it really doesn't give me that much information to be able to work with, such as pricing, since it's clearly a paid-for system. I'd hate to find myself liking it and then finding it is inordinately expensive. – Arantor Nov 24 '10 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.