views:

264

answers:

1

My site needs a chat room, and I'm also looking to implement a facebookesque person to person chat system.

What is most cost-efficient/performant (purely in terms of bw and server) for me. A regular 1 second poll ajax chat, or a comet solution.

Thanks.

+1  A: 

Comet would typically result in lower bandwidth usage (assuming less than 1 chat message per second per chat on average), owing to the fact that it will only query the server once per message sent. It would typically result in more concurrent active connections to your server though.

This blog article may help you visualise it better.

Dan McGrath
Thanks for the link, but that is a pretty biased article. I understand that comet results in lower bw use, but what about server resources? Thanks.
Mark
Yeah, it is. Remember though, for each HTTP connection you have to do the whole TCP/IP handshake, which is a relatively expensive set of operations. So by polling every second you are smashing your server pretty quickly with raising user counts. Everything depends on how many clients you expect to have on your server at a time, since it all comes down to scale. I think if you get to the point where you really have to be concerned with server resources used by comet, your probably already at the point you need multiple servers and load balancers...
Dan McGrath
Thanks for the answer. :)
Mark