Does single-threaded mean one request at a time in Node.js?
No. Node.js handles many concurrent connections. The JavaScript code runs on one thread, but I/O operations are delegated to libuv, so the thread is free to process other requests while waiting for I/O to complete.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How Node.js Handles Concurrency on a Single Thread
Through the event loop and non-blocking I/O. When an async operation starts, the thread moves on. When it completes, its callback is queued, and the event loop processes callbacks one at a time. This lets one thread serve thousands of concurrent connections.
For operations that cannot be done asynchronously, like certain file system operations. These go to libuv's thread pool (default 4 threads), so they run off the main thread without blocking the event loop.
Because it uses far less memory than thread-per-request. One thread serves thousands of connections. The trade-off is that CPU-heavy work on the main thread blocks everything, which is why Node.js is best for I/O-bound work.
Still have questions?
Browse all our FAQs or reach out to our support team
