Dan D.
Dan D.

Reputation: 8557

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.

Upvotes: -2

Views: 50

Answers (1)

coagmano
coagmano

Reputation: 5671

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

Upvotes: 1

Related Questions