The answer is….aside from having a pretty amazing dev team of course, yep, Erlang. It’s basically a Comet HTTP server, with a C++ app handling the log of chat messages, and an Erlang based server to handle the polling and HTTP requests:

For Facebook Chat, we rolled our own subsystem for logging chat messages (in C++) as well as an epoll-driven web server (in Erlang) that holds online users’ conversations in-memory and serves the long-polled HTTP requests. Both subsystems are clustered and partitioned for reliability and efficient failover. Why Erlang? In short, because the problem domain fits Erlang like a glove. Erlang is a functional concurrency-oriented language with extremely low-weight user-space “processes”, share-nothing message-passing semantics, built-in distribution, and a “crash and recover” philosophy proven by two decades of deployment on large soft-realtime production systems.

It’s all here

The other really interesting thing that this mentions here is Thrift, which is the Facebook platform for enabled simple RPC communications between different apps. It’s available open source here, and if anyone has used it definitely let me know how it worked out for you.

Am I first? Am I first? Am I first? No? You mean all the other thousands of Adobe bloggers beat me to it? Aw. Drat. Anyways: link. Click on my ads and buy stuff. Just kidding. I write this blog out the sheer love of blogging and no other discernible platform on which to express myself. :)

If you don’t read Steve Yegge’s blog, you totally should. Because this post, which is the transcript of a talk he gave at Stanford, is awesome. Almost all of his posts are awesome, the only ones I exclude from the ‘awesome’ category are those which are merely ‘pretty damn good’. This quote in particular has given me pause:

In Java 1.0, when you pulled a String out of a Hashtable you had to cast it as a String, which was really stupid because you said

String foo = (String) hash.get(…)

You know, it’s like… if you had to pick a syntax [for casting], you should at least pick one that specifies what you think it’s supposed to be, not what it’s becoming – obviously becoming – on the left side, right?

But, but, but…isn’t that what all languages are supposed to do? Well? Think about it. Is it?

Open, free, fabrication laboratory. Too bad it’s right in the heart of my least favorite city in America. Well, maybe I dislike Miami more. Tough call. Anyways, if you’re not as averse to Boston as I am, check this out: Fab Lab

What two things have I been thinking about in the last 24 hours? Aside from how to get GL_SELECT to work properly with OpenFrameworks (!) and where a good optometrist can be found in Brooklyn that is. It’s 1) fmodex versus openal. I posted up my little openal + OF example and found that no one was particularly impressed. Why is that? Oh, because OF already includes fmod, which is, afaict, the 3d and gaming sound library. Looking through the API it’s slightly less friendly, but way more powerful. I promptly set about whipping up a small example of 3d sound using 3d spheres to position the listener and sound source in OF (which was how I got lead into the GL_SELECT problems). So I guess I’m gonna drop the openal stuff and start learning the fmodex C++ api a little better, which, if there’s better documentation out there than what I could find on their site and the fmode.h file, somebody lemme know.

On the web side of things, I found a really cool article on using mochiweb, the erlang web framework built out by Bob Ippolito and the gang at MochiMedia, with ErlyWeb. It’s short, but I think it could be promising. I’ve played around a little bit with ErlyWeb and I think it’s quite promising. I haven’t played around much with MochiWeb, but I’ve read the source and found it impressive. Do they need to get put together? Not really, since erlyweb is built on YAWS, while Mochi is not, so you’re mixing and matching with some weirdness there, but I think it’s nice nonetheless that there are already two usable web server frameworks out there for people who want an introduction to working with Erlang.

For the XCode savvy (and OF possessing as well) out there: Simple little example using OpenAL and OpenFramework together, the only really interesting part here is the following mouse callback in the ofApp mouseMoved callback:

void OpenALApp::mouseMoved(int x, int y ){

	float fx = (float) x;
	float fy = (float) y;

	SourcePos[0] = (fx - 512) / 10;
	SourcePos[1] = 0;
	SourcePos[2] = (fy - 384) / 10;

	alSourcefv(Source, AL_POSITION, SourcePos);
}

The alSourcefv call sets the location that the sound appears to originate from using the mouse position.

The zip is here for download and includes the XCode project.

If it’s true. That’s. Um. Big. Isn’t it? But wait, here’s someone saying the opposite? Does it matter? Um. Kind of? I don’t know. I’m really confused when I think about Rails these days.

I like 20bits

And in particular I like this post on optimizing MySQL. Really though this could be applied to almost any DB system, design your DB schema correctly, use profiling and benchmarking tools, use vertical partitioning of tables (this is one I don’t think of enough, generally), use indices correctly (i.e. where they’re needed). All in all, pretty sound advice and a pretty good blog. These tips may not be much good for you if you can’t change the schema you’re using (i.e. you’re in maintenance-ville like me currently, sigh) but still, I’d bet that by benchmarking and profiling all the queries you could find the slowest ones and improve them somehow.

http://humani.st/scalable-web-apps-erlang-python/

Mentions mochiweb and how py+erl helps solve multiple problem domains and over multiple languages. Interesting stuff, for reals.

The article is here, and the gist is here:

The ability to use different languages when they suit the task at hand is a sign of a good coder. The more languages you learn, the easier it is to pick up a new one. Eventually, you start thinking of every new language as just a set of modifications to a language you know already. So what languages should you learn that will help you to quickly build up the set of basic concepts and let you pick up other languages easily? The rest of this article contains my answer to this question. Note that I’m not necessarily advocating using any of these languages for a real project, but I believe that learning them will make you a better programmer in whatever language you do use.

So what does he recommend. Pretty usual suspects for the most part, with one exception:

  • C (standard)
  • Smalltalk (yep)
  • Lisp (yep)
  • Erlang (newish, but MP and Concurrency)
  • Haskell (I hear this a lot, maybe that’s where I hang out though)
  • Prolog (this one stands out)

It’s also worth remembering that you don’t have to use a language to benefit from knowing it. If you know assembly language for the processor on which you’re working, this knowledge will help you in writing high-level code, since you’ll be able to keep in mind what’s actually going on when you execute your code. Similarly, familiarity with a higher-level language will help you to write better-structured code in a lower-level language.

I’d agree with that. The little bit of Lisp and Erlang that I learned have helped me (and frustrated the hell out of me when I have to maintain old semi-OOP legacy code) immensely in thinking about problems and code structure.