javascriptnode.jsmultithreadingserverjxcore

Multithreaded solution (instead of multiprocesses) for reporting server


NodeJS is still not multi-threading after those many years since first release. JXCore is multi-threading but dead. I need multi-threaded JS server for my project, any solution?

NodeJS cluster mode can't solve my problem as my server has reporting API, 4 heavy reporting requests from client-side can hang the whole 4 CPUs of my server.

It should better slow down all requests rather than having capability to serve 4 heavy requests only.


Solution

  • NodeJS does support multi-threading via the child_process API.

    You can use child_process.fork to spawn new threads running a specific js module and opens an IPC communications channel to pass data back and forth between them.

    Documentation here