Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5962

Is This Single Node.JS App Using Multiple Cores?

$
0
0

On an Ubuntu 18.04 system running only 1 Node.js script that ingests a data feed, htop shows that both CPU cores are being utilized.

With 1 node script running:enter image description here

With NO node.js script running:enter image description here

This Node.js script has multiple event listeners that receives data, does some data processing and sends them to a remote database server.

foo.on('msg', msg => { setImmediate(() => do_work(msg)) } );

Question: Why does it appear as if both CPU cores are being utilized rather equally by Node, despite Node.js being single threaded? CPU load splits observed are 60%/40% and 50%/50%

Is it actually utilizing both CPU cores? Or simply switching between them really quickly all the time, but only really utilizing 1 core at any one time? In other words, such a scenario will cause the system to choke when the CPU workload is above 1 core's worth but lesser than 2 core's.

Basically, I like to know whether a single-core system will suffice for this work load. Thank you!


Viewing all articles
Browse latest Browse all 5962

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>