2

I am planning about a chat system for my website. I am thinking about doing ajax pushing. The client will initiate a connection to the server by calling chat.php. chat.php will do an infinite loop(30 sec). On getting a new message it will return the print the message to the client and exits the connection. The ajax script on getting a responseText calls chat.php once again. My question is the scalability of such a system(php driven COMET) for 500 concurrent chat processes on a shared hosting package.

Killswitch
  • 346
  • 2
  • 12

1 Answers1

2

My question is the scalability of such a system(php driven COMET) for 500 concurrent chat processes on a shared hosting package.

You won't be able to get away with this on shared hosting. Chances are that the Apache instance on the server is configured with a much lower concurrent connection limit. Even if it wasn't, having five hundred active PHP instances on a shared hosting account is going to get noticed and will severely degrade the experience for everyone else on the shared machine.

PHP is probably not the best tool for this job. If you want to do it with PHP, you're going to need a VPS or dedicated hardware. Honestly, even if you don't use PHP, you're going to need a VPS or dedicated hardware to implement a solution that better fits the problem (like a background process to serve the chat requests directly, something you can't do on shared hosting).

Charles
  • 50,943
  • 13
  • 104
  • 142
  • I would be glad if you could give an elaborated solution on "a background process to serve the chat requests directly"-that you just mentioned... – Killswitch Jan 21 '12 at 09:19
  • Look at Python's Twisted library and Node.js as good comet solutions. In both cases, they'd run in the background and serve requests instead of going through a web server process. – Charles Jan 21 '12 at 18:46