M
M
mmmq2021-07-13 19:09:52
Node.js
mmmq, 2021-07-13 19:09:52

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()'


Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Neverov, 2021-07-13
@mmmq

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 question

Ask a Question

731 491 924 answers to any question