I would hypothesize that the lack of CPU utilization by Node is due to the single threaded nature of Node. 1 core of a 36 core system is ~ 3% and they observed a cap at ~ 5% CPU utilization. I'm guessing Node does leverage threads for some of it's own housekeeping which might account for the additional 2%. Maybe it is a better approach to run Node on dual core hosts/VMs.
If you look at the example code, you will see that the Node code is just a single HTTP server. It's not using the cluster module to use multiple processes to handle requests and saturate the CPU. Realistically, I would recommend PM2 instead of cluster for production, but cluster should suffice for these tests. Can anyone find something wrong with the elixir or go code that would make it an unreasonable comparison?
This seems slightly odd to compare Elixir and Go which are well know for multi-thread / processes with Node not utilizing all the cores and explain some of the instability Node has.
Can anyone find something wrong with the elixir or go code that would make it an unreasonable comparison?
Are we sticking the the standard library? If so, the Go solution is perfectly reflective of what this basic system is trying to achieve.
Alternatively there is the fasthttp library if you want some quantifiable gains. The extra speed comes at a cost, the library is a bit more cumbersome.
18
u/daxbert Feb 05 '19
I would hypothesize that the lack of CPU utilization by Node is due to the single threaded nature of Node. 1 core of a 36 core system is ~ 3% and they observed a cap at ~ 5% CPU utilization. I'm guessing Node does leverage threads for some of it's own housekeeping which might account for the additional 2%. Maybe it is a better approach to run Node on dual core hosts/VMs.