Answer the question
In order to leave comments, you need to log in
Multithreading in Nodejs?
Hello. Read https://habr.com/ru/company/ruvds/blog/437984/
I have a class that is imported into a file and run. It needs to be run on a non-main thread. I don't understand how to do it.
import Test from './test
new Test()'
Answer the question
In order to leave comments, you need to log in
The easiest way to make an application multi-threaded is to use some kind of process manager, like pm2. What is said in the article, in general.
The point is that for 99% of tasks, node is single- threaded . And in the code there is no such command "make multi-threaded now". Even Promise.all runs functions one by one in asynchronous style.
Make asynchronous code, and create multithreading using third-party applications.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question