2

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 :)

Arantor
  • 123
  • 3

2 Answers2

0

For starters, its a much better approach than apache when using the nginx push module http://pushmodule.slact.net/

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

Arenstar
  • 3,602
  • 2
  • 25
  • 34
  • 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 08 '10 at 00: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 08 '10 at 00:58
0

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

  • 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