Multithreading in node


#1

what are the options for multithreading in cpu heavy tasks with node and meteor?

it’s sad that web workers are not compatible with the server. Is there a workaround for this?


#2

Node has had a cluster api since its early days that lets you fork child processes that run on a separate thread and communicate between the processes with an event bus. You can spawn a child process and run any executable on the system, so you can even have scripts or binaries in other languages, call them, and monitor their stdout or exit code. There’s also some packages that help you out with it like jxcore (never used it myself)