Erlang vs Rails processes FUD

Murphees Rant - Werner Schuster - June 07, 2007

Wow… I just read a uniquely silly piece of FUD in Is DHH right about concurrency?   Actually, the text is OK, I guess. It wonders whether Erlang’s shared nothing is better than Rails shared nothing approach. After all: Rails allows you to make use of multiple cores despite Ruby‘s userspace threads… it just starts multiple processes.

The silly bit comes later on in the article:

This argument also completely omits the memory overhead of Rails.  With a 50–70MB baseline and a real-world Rails process growing to nearly 200MB over time, a 64 core CPU will require at least 13GB of RAM to even run a single Rails instance per CPU core.

The silly bit? Here it goes:

Now, let‘s compare to Erlang processes, which have approximately 300 bytes of overhead… perhaps a naive comparison, but you get the idea.

Oh yes, I do get the idea, and don’t worry, the comparison is not naive It’s Bullshit He’s basically comparing the memory usage of a Rails process filled with data necessary for serving requests to the management overhead of an Erlang process.
After all: Erlang processes can be compared to userspace threads (the difference is that they don‘t share the address space). Every process needs some management overhead: entries in the scheduler or manager, some stack space or whatever else it needs. This is the 300 bytes of overhead of an Erlang process that was just created and hasn‘t yet had the time to do anything.

So… this comparison is comparing apples to orchards, and it‘s complaining that the latter is soooooo big and full of trees.

What‘d be a fair comparison? Well, one approach would be to check how much data the OS needs to create a new OS process (Rails process), which means page tables, internal structures, etc. This could then be compared to the 300 bytes of an Erlang process… naively. And yes: this ignores the loaded Ruby code (which, as far as I can tell, is not shared across Ruby instances), but then the 300 bytes don‘t include that either.

Approaching it from the other end, you‘d compare an Erlang process actually busy serving page, looking up stuff in Mnesia or caches or whatever. Of course, this is still problematic, since processes are a dime a dozen in Erlang, and it‘s as easy to start a process as to print “Hello World”, so there‘s the question what to compare against what.

Oh… and just to be clear: this is not a dig against Erlang, which is a great system and I guess ErlyWeb is worth looking at.
However the linked article/comparison is, frankly, Bullshit. Try again…



Categories: Blogs  Murphees Rant