5 ms·
Are there plans to take advantage of multiple cores automatically? Couldn't it do something like Nginx and spread the workload to multiple cores?
by va_coder 15y ago
Are there plans to take advantage of multiple cores automatically? Couldn't it do something like Nginx and spread the workload to multiple cores?
- tmcw 15y agoMight want to check out Cluster - http://learnboost.github.com/cluster/ http://learnboost.github.com/cluster/ (won't belabor the point about node/v8's architecture and multi-cores/systems)
- va_coder 15y agoThanks for the link. I guess I'm trying to figure out why there's so much excitement about a server that is not designed to spread the workload to multiple cores for you.
- kevindication 15y agoScalable networking doesn't require multiple cores, just good use of the select/poll mechanisms at your disposal (well, and bandwidth). If you've got a CPU bound problem, you might farm that out to something else.
- mcantelon 15y agoIt doesn't do everything, but it's exciting for a number of reasons. 1) Javascript is a nice, powerful language. It's easy to find JS programmers. Bonus: you can share code between the server and browser. 2) Node provides a clean slate for server-side web dev: fresh, largely asynchronous libraries delivered via a well-designed package manager (npm) that I don't cry when I have to use. 3) It's an accessible way to program asynchronous server-side TCP/IP applications. Socket.io (WebSocket sever with multiple transports to fallback to) is an example of why this is useful. The lack of interprocess communication that would help parallelize tasks between cores is the one thing that's lacking. AFAIK there are plans to address this (although given Erlang's maturity it will likely still be superior for this use-case) but even without that Node is very, very useful to many people right now.
- ianl 15y agoYou can just start up X instances of your server for X cores. This way you have completely independent processes running and maintain data independence without getting bogged down with synchronization and other messy issues.
- simonw 15y agoNode's sweet spot is I/O bound tasks, not CPU bound tasks.
- chrismealy 15y agoDoes anybody know if it's guaranteed to spread across your cores evenly (exactly one node proc on each core)? I skimmed the source but couldn't figure it out.
- baudehlo 15y agoNo. That's up to the OS.
- baudehlo 15y agoThe plan is to keep the core lightweight. What can be done in an add-on module should be done there. There are a couple of options for this, cluster as linked above, or something like hook.io[1] for erlang-like distribution across N nodes. [1] https://github.com/Marak/hook.io https://github.com/Marak/hook.io