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.

4
  • stackoverflow.com/questions/1633793/… Commented Jan 20, 2012 at 20:37
  • 4
    That's like asking "Can I haul a load with a car?". How big of a load, how big of a car? If your shared hosting package is an 8088-4.77Mhz with 640k of ram, then I'm going to say "No, it won't scale". Commented Jan 20, 2012 at 20:38
  • A 30 sec loop is not an infinite loop... ;-) Commented Jan 20, 2012 at 20:42
  • ^Dats Y i mentiond 'infinite loop(30sec)' ;) Commented Jan 21, 2012 at 9:07

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.