How can I tell if a Node.js operation uses the thread pool?
Network-related operations typically use the OS's async I/O directly. File system, system DNS (dns.lookup), and certain crypto operations typically use the thread pool. The Node.js docs and libuv source are the authoritative references.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Which Node.js Operations Use the libuv Thread Pool?
File system operations (fs module), DNS lookups (dns.lookup), some crypto operations (crypto.pbkdf2, crypto.scrypt), and some zlib operations. Network I/O does not use the thread pool; it uses the OS's async capabilities directly.
No. Network I/O (TCP, UDP, HTTP) uses the OS's async APIs directly through libuv, which is why Node.js handles thousands of network connections efficiently without using the 4 default thread pool threads.
Because the OS provides reliable async APIs for network I/O, so libuv uses those directly. For file systems, the OS does not provide reliable async APIs on all platforms, so libuv uses the thread pool to avoid blocking the main thread.
Still have questions?
Browse all our FAQs or reach out to our support team
