Set UV_THREADPOOL_SIZE in the environment before starting Node.js. The default is 4. Increase it if your app does many concurrent fs, DNS, or crypto operations. Monitor CPU usage and event loop lag after changing.
How to Tune the Thread Pool Size in Node.js for Performance
How do I tune the thread pool size in Node.js?
The answer
More FAQs in How to Tune the Thread Pool Size in Node.js for Performance
When your app does many concurrent file system operations, DNS lookups, or crypto operations, and the default 4 threads are a bottleneck. Monitor to confirm the bottleneck is in thread-pool operations, not elsewhere.
No. Network I/O does not use the thread pool; it uses the OS's async capabilities directly. Increasing the pool size only helps for fs, DNS, and crypto operations that use the thread pool.
Match it to your CPU count and workload. On a 4-core machine, setting 16 threads does not help, since the cores cannot run 16 threads at once. More threads mean more CPU contention. Start from 4, increase, and monitor.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.