Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A 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. 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



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: