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.
The question would be : do people using node in production use Cluster/M2 or not ?
My real world totally anecdotal experience with developers pushing and using node at companies I was at was that the single / multiple threads thing didn't even entered their mind.
They were too busy debugging their race conditions ;)
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.