Does Erlang consume too much energy?

The paper relies on benchmarks from the Computer Language Benchmarks Game. Erlang has a long history of debating those benchmarks, since they are not very representative of the kind of applications Erlang is uniquely suited for.

A noteworthy example of that might be that the study in question excluded the thread-ring benchmark, because too few languages even had a working solution for it (in newer versions of the benchmarks game, this test seems to be completely missing). This is one of the few benchmarks in the suite where Erlang really shines, even though the parameters have been adjusted down to make it more possible for other languages to compete: the number of processes in the ring was for example limited to 503, since many environments would crash on higher numbers. By contrast, Erlang can easily handle hundreds of thousand processes, even millions, with no performance degradation.

There is more: In long-running, complex systems, performance is often limited by other things than sequential speed. The inventors of Erlang had long-since known that about 90% of the performance in telecoms systems depends on speed in process spawning, context-switching and message passing, so Erlang was designed to excel at this. Also, over time, memory fragmentation may hurt both performance and memory efficiency, so Erlang has highly sophisticated memory management to keep fragmentation at a minimum. Erlang is also very good at idling when nothing happens. These things can easily become disadvantages in short micro-benchmarks, where the goal is to perform one task with maximum speed and then terminate. This is also not how blockchain nodes behave.

Looking at the Aeternity seed nodes, the cpu ‘idle’ is at ca 97%. The node uses around 400-500 Erlang processes, which is not much for an Erlang system, and their aggregated memory footprint is around 150MB. I’d say the system is running pretty efficiently.

13 Likes