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 NO node.js script running:
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!