DEV Community

loading...

How many threads should I create? (worker_threads) Nodejs

sovietspy2 profile image Barney ・1 min read

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?

Discussion

pic
Editor guide