News for hackers. Stuff that matters.
Re:How Facebook uses Erlang for real-time chat by melvinram on Sunday February 07, 2010 @09:55PM (#1108769)
I haven't used Erlang but I wonder if people will start blaming Erlang as "not stable" since Facebook chat is so unstable... the same way people said Ruby on Rails couldn't scale because Twitter was haven't problems scaling.
Re:How Facebook uses Erlang for real-time chat by gosuri on Monday February 08, 2010 @03:04AM (#1109319)
I believe its the Frontend implementation of the Chat that's unstable. Meebo has done facebook chat implementation pretty well.
Re:How Facebook uses Erlang for real-time chat by mononcqc on Sunday February 07, 2010 @10:58PM (#1108894)
I hope not, because it's hard to blame only Erlang.

First of all, they rolled their own epoll-based server for the whole chat system.

Then, instead of using a 'sane' comet/long-poll implementation based on JSONP (to avoid limitations of same-domain requests), it seems that they used a scheme where the chat nodes have a fake subdomain like 'http://N.subdomain.facebook.com/.... I don't know how efficient this is supposed to be, but I haven't seen that too often.

Of course, it's wholly possible their Erlang implementation of the chat system is the reason why it fails. Personally, I have never had much trouble with their chat, although I haven't used it much either.

Re:How Facebook uses Erlang for real-time chat by lukatmyshu on Monday February 08, 2010 @12:34AM (#1109097)
The reason that they use N.subdomain.facebook.com is so they can avoid the default "2 http requests per domain" rule in older browsers.
Re:How Facebook uses Erlang for real-time chat by mononcqc on Monday February 08, 2010 @01:59AM (#1109228)
I know that. What I don't get is why they chose that over JSONP, which solves the exact same problem by using <script> tags and a callback function.

Their solution seems to work well, anyway.

Re:How Facebook uses Erlang for real-time chat by catch23 on Monday February 08, 2010 @04:19AM (#1109390)
The jsonp method causes older browsers to use a ton of memory if you leave the browser window open for a long period of time. You'll see that there's a whole bunch of script tags in the dom that aren't cleaned up. Given the way people use facebook & how many old browsers still exist, this is probably the reason facebook decided against it.
Re:How Facebook uses Erlang for real-time chat by axod on Monday February 08, 2010 @05:02AM (#1109437)
jsonp also causes unsightly "loading" indicators in most browsers.
Re:How Facebook uses Erlang for real-time chat by lukatmyshu on Monday February 08, 2010 @11:04AM (#1109957)
Plus w/ jsonp can't get the response from POST requests and you don't get notification that your page didn't load. So your web-stack needs to be able to handle sending any errors via jsonp as well.

In any case, they don't solve the same problem. Jsonp solves the problem of talking to another domain (PostMessage does the same thing). Channels solve the problem of the browser limiting the number of concurrent HTTP requests you can have open to one domain.

Re:How Facebook uses Erlang for real-time chat by rjurney on Monday February 08, 2010 @12:10AM (#1109049)
Given how easy it is to scale an Erlang app to provide incredible reliability in concurrent systems - as that is what the entire language is optimized for - this is pretty unlikely.
Re:How Facebook uses Erlang for real-time chat by axod on Monday February 08, 2010 @05:04AM (#1109439)
Is chat a 'concurrent system'? :/
Re:How Facebook uses Erlang for real-time chat by rjurney on Monday February 08, 2010 @01:45PM (#1110351)
Yeah.
Re:How Facebook uses Erlang for real-time chat by warfangle on Monday February 08, 2010 @08:08AM (#1109619)
Then again, the way Twitter overcame their scaling issues was to.. uh, well.. move off from Ruby for a portion of their stack.
Re:How Facebook uses Erlang for real-time chat by sjs382 on Monday February 08, 2010 @08:06AM (#1109616)
I thought the same thing. :)