3 ms·
While your premise: > Running out of CPU will cause problems regardless of what platform/framework/system you're using. Is technically correct, your subsequen
by AdieuToLogic 11y ago
While your premise:
> Running out of CPU will cause problems regardless of what platform/framework/system you're using.
Is technically correct, your subsequent conclusion is faulty in this context since Node.js does not intrinsically use more than one CPU:
> A single instance of Node runs in a single thread.
(source: https://nodejs.org/api/cluster.html https://nodejs.org/api/cluster.html)
Therefore in the context of a "meaningful software solution", if it is desired to utilize more than one logical CPU on a machine (of which modern server hardware typically have numerous), then choosing a platform capable of running on more than one CPU would allow a solution to do so by definition.
Node.js, according to the project's documentation quoted above, does not provide this support.
- jondubois 11y agoA single Node.js process does in fact use more than a single CPU core when it performs IO operations (it uses threads behind the scenes). But you would be right in thinking that your own code runs in a single thread/process by default. That said, Node.js makes it really easy to spawn and communicate with other Node.js processes - https://nodejs.org/api/child_process.html https://nodejs.org/api/child_process.html. To compare it with Go; the main feature which Go has over Node.js is that Go allows you to run functions (defined in the same source file) as separate processes/threads. Node.js forces you to separate processes into different files. I think that this feature of Go is cool at first but I don't think you would use it that often in a large-scale app. Usually you want to separate processes into different source files (for the same reason that you would want to define different classes in separate files). There are many Node.js modules which automatically leverage multiple CPU cores. I'm the main author of one such module: http://socketcluster.io http://socketcluster.io