Home Ask Login Register

Developers Planet

Your answer is one click away!

Maciej Ketus February 2016

Node.js: What is most efficient way to delegate CPU-heavy work?

Every single book, tutorial and course out there says that node.js doesn't handle heavy CPU computation very well but I haven't crossed one that suggest any solution.

Do you think it is good idea to deal with said computation problem by writing separate worker in technology that better handles it and consume results from node via - say - REST API?

  • Any suggestions on how to handle this?
  • What is that you usually do?
  • Did somebody already solved this problem?


David Haim February 2016

The main advantages of Node.js as a platform is that it was written from to support asynchronous IO right from the beginning. it is also gives the productivity of JavaScript into Server-side development.

This has being said, since the language has dynamic type system and runtime JIT compililing , specific static-compile time optimization which are extremly helpfull for CPU-bound tasks simply cannot be done.

I initially wrote it as a joke, but when I thought about it again, there is nothing wrong rewiting specific CPU bound tasks in C/C++ and link with the addon mechanism. The platform itself direct to there

further read: https://nodejs.org/api/addons.html

Post Status

Asked in February 2016
Viewed 1,300 times
Voted 13
Answered 1 times


Leave an answer

Quote of the day: live life