-1

As it is evident that AJAX based chats do not scale, so what would you use for chats? Custom servers? Or any other methods?

Since with Rails each chat connection will take lots of memory, it won't be feasible to even have Rails run for each message. What do you recommend for use here?

halfer
  • 19,824
  • 17
  • 99
  • 186
Amit
  • 3,952
  • 7
  • 46
  • 80
  • 3
    Accept some answer if you want other people help you – shingara Dec 14 '10 at 12:56
  • 1
    Why you think chat server Ajax Based don't scale ? Highrise/chat.stackoverflow has made like that ... – shingara Dec 14 '10 at 12:57
  • Ajax based chat systems use long polling, and with servers like apache, they wont scale. With Nginx, the number of chat users increases, but event hat has a limit. Services like gmail, and facebook cannot run with ajax, because they will be overloaded. – Amit Dec 14 '10 at 13:14
  • and if you notice not everyone gets to chat in stack... and also they use nginx, so they can tolerate a higher percentage. – Amit Dec 14 '10 at 13:17

5 Answers5

1

I also tried to implement a sample chat app with AJAX (in built Ajax.updater) but it didn't workout. I'm sure there might be some good ajax solution.

But since this is based on server push technology, try Juggernaut (http://juggernaut.rubyforge.org/). I personally haven't tried, but it seems like it's good.

Or else consider web sockets (in HTML5) if possible.

halfer
  • 19,824
  • 17
  • 99
  • 186
sameera207
  • 16,547
  • 19
  • 87
  • 152
1

People often use Evented Ruby for handling problems like this https://github.com/eventmachine/eventmachine one of the examples in a talk I went to at railsconf 2010.

For example http://playtype.net/past/2009/3/11/mini_an_eventmachine_clone_of/ is a evented ruby implementation of an irc bot

Scott Schulthess
  • 2,853
  • 2
  • 27
  • 35
1

Unfortunately your post is based on a false premise. AJAX based chat certainly can scale, you just have to do it the right way. Juggernaut 2, for example, uses Node.js to handle many concurrent connections. You're right, you won't be able to handle 10,000 connections on a single server. That's what load balancing is for.

Chris M. Welsh
  • 487
  • 1
  • 5
  • 11
0

Do you have some data based on quantitative testing (aside from your own qualitative conclusions)?

Pablo
  • 285
  • 1
  • 2
  • 7
  • yes, i looked up on memory usage of apache and nginx with 10,000 users. Apache turned out to be a machine killer, while nginx survived, but i am not sure for how much longer. There is a reason why something like sockets.io was made... to prevent loading the webserver. So that makes me quite sure that long polling is not a scalable approach. – Amit Dec 14 '10 at 13:16
0

Why create any kind of custom server for chat? IRC has been around for quite a while and is tried and tested.

The real question here should be about client-side implementations rather than trying to reinvent the wheel server side imo.

Lee
  • 878
  • 7
  • 16