DEV Community

Barney
Barney

Posted on

How many threads should I create? (worker_threads) Nodejs

I recently started looking into nodejs's thead_workers module. It seems really interesting however there is one thing that is not self-evident. The official documentation says that I should create a threadpool. But what should be the size of my threadpool? Should it be equal to my phyisical CPU count or cpu's thread count? For example I have a i5 with 4 cores and 8 threads. On my machine should I create a threadpool of 4 or 8? Less or more?

Top comments (0)