I started learning nodejs some time back, and the cool thing about it is that whatever the developer writes, runs on a single thread.
But when I do a non-blocking file I/O or network I/O, some thread has to wait for the response, and that is being done by the underlying V8 architecture.
We say that nodejs process runs on a single core because there is only 1 thread allowed, and we'll need multiple threads only then CPU can schedule them to different cores.
But when we say that nodejs process runs on a single core, does it mean that the underlying V8 javascript engine is also running on a single core? All node processes use the same instance of V8 js engine or is it like a separate support for each of the processes?
These questions are coming to mind because I want to create clusters for a nodejs process, and I wish to know if I can create n
clusters on an n
core machine or should I leave a significant number of cores for the V8 engine?
Edit: Found a link which gives some answer http://blog.carbonfive.com/2014/02/28/taking-advantage-of-multi-processor-environments-in-node-js/
"These child Nodes are still whole new instances of V8. Assume at least 30ms startup and 10mb memory for each new Node. That is, you cannot create many thousands of them."