
Benchmarking Go vs. Node vs. Elixir - pplonski86
https://stressgrid.com/blog/benchmarking_go_vs_node_vs_elixir/
======
markus_v
Not sure but it kind of seems like they are running only one (single-threaded)
Node process on multicore CPUs.

~~~
wiennat
This immediately comes into my mind when I see the charts.

It is also interesting to see that only one Node process can barely serve 10k
connections.

\---- After I check the source at [0]. They use a simple http module to serve
the requests while they use `http.ListenAndServe` which spawns go routines,
hence more CPU utilization.

[0]
[https://gitlab.com/stressgrid/dummies](https://gitlab.com/stressgrid/dummies)

~~~
kt315_
Author here. Planning to run the same test using cluster module with one
worker per CPU.

What would be the most performant way to serve HTTP in Go?

~~~
trp1
Well I believe few people use the built in http module in go. Not sure if
you're testing would allow for 3rd party frameworks but the Iris framework
loves to claim fastest go web server. Gorilla or gin are also popular.

As for the structure of it you would like have everything split out into
goroutines with a worker pool of goroutines ready to ferry the data from
request to backend and back to client.

~~~
fileeditview
There are so many options to choose from. But don't use Iris.

See
[https://www.reddit.com/r/golang/comments/57w79c/why_you_real...](https://www.reddit.com/r/golang/comments/57w79c/why_you_really_should_stop_using_iris/)

------
supermatt
Id like to see metrics on memory consumption - is this something you could
add?

~~~
kt315_
Good point, will add.

~~~
supermatt
many thanks!

------
therockhead
Would be interesting to compare with Java.

~~~
pjmlp
Easy,

[https://www.techempower.com/benchmarks/](https://www.techempower.com/benchmarks/)

------
johnisgood
Slightly off-topic, but: I love those graphs. Any ideas how they created them,
or what they are using?

~~~
crave_
Possibly using ggplot2:
[http://www.cookbook-r.com/Graphs/Plotting_means_and_error_ba...](http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_\(ggplot2\)/)

------
gyrgtyn
Wonder how much the anonymous function in the node handler affected it.

Not sure what `body` not having `var` in front (so it gets put on global)
would do either.

------
rekoros
Surprising that BEAM is such a CPU hog!

~~~
toast0
BEAM has some heuristics where it can switch to a busy wait in some cases in
an attempt to reduce latency. This is tunable with the +sbwt argument to erl;
but the default means it's hard to use the system CPU % as a load indicator.

------
someguy101010
Tldr?

~~~
hactually
Node bad, Elixir good but spikey on the CPU, Go best.

~~~
Juliennng
It seems the Elixir CPU usage is due to the way the Erlang VM manages
schedulers. A scheduler will literally busy-wait if it thinks there might be
more work to do soon, in an effort to improve the responsiveness of the system

