How many threads Node creates per core when using worker threads? #478
-
Dears, I'm running node js worker threads on MacBook Air M1. There are 8 core. And using PISCINA to create threads. I'm getting 12 threads. Are those for one core or on all 8 core. How do I know if main thread is blocked/being used in worker threads when running workers for all threads? When running on all threads, other requests are getting blocked. I want to use all cores and full capacity of threads without blocking main thread. Also, when I see the CPU utilisation when worker threads are running, its not crossing above 30%. It looks like threads are spawned on single core. I really need performance here. And I see the CPU utilization is not crossing 25% while in worker threads mode. It looks like I'm underutilizing resources. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
👋 It depends on your workload. CPU scheduling is tricky; sometimes the workload does not require all the threads to be active nor spawned simultaneously and, for instance, going idle. If you want to use all your threads, I suggest you to tweak Also remember that the task balancing goes in a |
Beta Was this translation helpful? Give feedback.
-
Hello Carlos, |
Beta Was this translation helpful? Give feedback.
Yes, for sure; you can increase it as many as you need to tweak the performance you are seeking for