[erlang-questions] node.js vs erlang

John Kemp john@REDACTED
Tue Jun 17 15:58:06 CEST 2014


On 06/17/2014 08:41 AM, Joe Armstrong wrote:

[...]

> Node is very popular so I'm trying to understand what it is about node
> that is attractive.

One of the reasons not yet mentioned for the popularity of node is the 
"non-blocking, event-driven model" it uses.

But performance, ultimately, comes down to the underlying resources you 
have (unit CPU, unit memory, network bandwidth between units) and how 
they are allocated.

It's not that node gets this advantage "wrong". But in my experience, 
any programming language can be used to exploit these underlying 
resources appropriately, depending on how one arranges the resources, 
and programs the whole system. This only changes when you consider 
changes in the way underlying resources are configured (standard CPU vs 
GPU vs FPGA for example)

Ruby vs. Java vs. node vs. Erlang vs. whatever makes no sense on that 
level - they can all be used to make systems that work, depending on how 
you use threads, processes and callbacks in a scalable manner, and how 
much scale you need.

So in one sense, you should simply use your favourite language to do 
whatever you want to do - as long as you understand how your system will 
need to scale, and you are happy with whatever you will have to do to 
make it scale for use, then all is good.

Certain things, however, make scaling simpler.

One of those things is having the ability to write a serial-looking 
program, and yet having it easily form part of a parallel system. This 
makes following the flow of control in a program much easier.

Another of those things is being able to "know" that your variable is 
assigned only once and doesn't change after initial assignment.

I could mention other features of Erlang that make acquiring good-enough 
performance much easier than it is with other languages.

In summary though, I believe that at a "whole-systems" level, node has 
no particular performance advantage (assuming standard CPU architecture) 
that would make me choose it over Ruby, Java or Erlang (all of which I 
find easier to program, for different reasons).

I might choose node because the other developers on the project are node 
specialists. But similarly, I would feel comfortable choosing whatever 
other language made sense for reasons of team experience, or 
readability, or some other non-performance reason.

Having used Erlang, it is difficult for me to use other languages, 
because of the combination of elegance and large-systems functionality. 
But I do it, knowing that teaching others how to program Erlang is not 
my primary job responsibility, and that appropriately-scalable systems 
can be built in most common languages, as long as you understand how to 
make a reasonable rough cut at the first version of the system and what 
to do with the measurements you should make afterwards :)

So, I think that what makes node attractive is pretty much a fallacy, or 
rather, that this claimed advantage of node (non-blocking, event-driven 
IO) has significant disadvantages over other languages, when thinking at 
a whole-systems level.

Regards,

- johnk



More information about the erlang-questions mailing list