tags:

views:

109

answers:

2

Chicago Boss seems like a neat framework and a good excuse to learn Erlang.

Have any of you used it? Can I really get great performance hosting it on a single machine?

+1  A: 

Generally Erlang is about 4-5 times slower than doing the same thing in C, though what it loses in speed, it gains in efficiency, simplicity and stability. Doing the things that Erlang excels at, I think it lies around 2-3 times of C. It can also be compiled to native binaries to speed it up about 20% more.

Just know that there are tons of common things that Erlang isn't good at, like string manipulation and number crunching. Erlang was made for distribution (in most senses of the word), so that's what it's awesome at.

Oh, and about the great performance on a single machine: Not more than half of what a C app would. But then again, that is still probably 30-40 times faster than the equivalent in ruby, php or python.

Tor Valamo
So what is Erlang good at?Also, doesn't Erlang take care of a lot of things you have to deal with manually in C (like garbage collecting)?
Yes, that's what I mean with efficiency, simplicity and stability. Basically what takes 10 lines of code in Erlang takes 100 in C. And the error handling in Erlang is dead simple, as well as spawning new processes. Those things take a lot of development time in C. And Erlang has 99.9999999% uptime in real life apps, simply because it's designed to fail without crashing, because it had to be used in telecom and things like that. And you can update your app while it's running, which is very rare.
Tor Valamo
Oh, and about garbage collecting.. there's no such thing, per se. Erlang doesn't have state, it's a functional language. Variables can be set only once, so a memory overflow can't happen (unless you f**k up severely, or do it on purpose).
Tor Valamo
Tor: you do have to watch memory, i.e. make sure that a process' mailbox doesn't fill up, and you don't allocate many many new atoms.
Gene T
@Gene T - Of course, but that's not a GC issue. ;) And letting users set atoms is a nay-nay, so if you manage to code up 20.000 atoms, you're pretty busy. :P
Tor Valamo
+1  A: 

I can't speak for Chicago Boss performance specifically, but Erlang web servers are generally very quick.

They are also very good for multiple concurrent connections, due to Erlang's concurrency primitives. I know Chicago Boss doesn't use Yaws, but here is an Apache vs. Yaws graph, just for reference.

Agreed, C is faster in many cases, but any speed you will gain from C in processing, you will lose when you have multiple users. Think of it like this:

  • C may take 10 time units to complete a task, but 20 units to switch to the next client and back.
  • Erlang might take 15 units of time to complete, but will take about 5 units to switch clients.
  • DISCLAIMER: Time units are just relative terms. I'm not saying those are the correct proportions either, I'm just saying C's speed advantage will not be as big a factor once you start having multiple things going on at once, which is what Erlang is made for.
samoz