jeramyRR

jeramyRR

Anyone know why Elixir's CPU usage is so high in this benchmark?

This is an interesting article to read. Elixir’s performance, like usual, is excellent. However, it seems like the high CPU usage is counter to what I would have expected.

Link to article: [Benchmarking Go vs Node vs Elixir](http://Benchmarking Go vs Node vs Elixir)

Most Liked

OvermindDL1

OvermindDL1

Elixir (well, the BEAM) does a LOT more than just opening, reading, and sending on sockets unlike Go, it also handles reliability between processes, supervision trees, etc.. etc… Where a single bit of bad code (which is dreadfully easy in Go due to its weak typing) will bring down the entire Go server, where that just won’t happen on the BEAM. In addition the BEAM is also managing distribution data, immutable message copying (to help with that reliability) between the actors, etc… etc..

In short, the BEAM is a lot more heavyweight yes, but it scales very well regardless and it has reliability characteristics that node and go could (at this point) only hope to dream of.

Overall, if I am going for absolute pure performance then I’d use Rust, its performance, like well crafted go and well crafted C/C++ is already as fast as you can get, except with Rust you also get many guarantees that you don’t get with go, C/C++, or even Elixir, however you lose a lot of the distribution capabilities that are just inherent to the BEAM itself.

If I’m going for something that I don’t want to go down, ever, the BEAM is unmatched with its combination of distribution abilities, supervision trees (OTP in general), and ability to hot-code reload a running a system.

In general: Node is both slower and it’s unsafe. Go is faster but it is still unsafe. Elixir is more heavyweight but still fast and safe both, while being able to scale in ways unmatched elsewhere. Rust is both crazy fast and still very safe, not necessarily like Elixir’s safety but in a different way, just not as easy to distribute as Elixir.

It’s what I expect in other words. :slight_smile:

32
Post #2
kt315

kt315

Benchmark author here. As I mentioned in the blog, BEAM was very responsive while saturating the CPU. After talking to people the theory is that significant fraction of CPU was used by busy waiting, in other words BEAM would “burn” some CPU cycles before resorting to kernel synchronization to achieve better performance. There is VM setting that controls that: +sbwt. Next time I will be running this benchmark with Elixir I will specifically look at microstate accounting to confirm this theory.

19
Post #4
abtrapp

abtrapp

For those who don’t follow the blog: busy waiting test on The Curious Case of BEAM CPU Usage

Your article? That’s what I call a detailed analysis :slight_smile: - TNX!

Where Next?

Popular in Discussions Top

kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
Owens
Hello all, I am developing a new mobile app with Flutter frontend and Phoenix backend. The mobile app has real-time task management and c...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New

Other popular topics Top

ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 43657 311
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement