How many threads does Node actually create ?
How many threads does Node actually create ?
Node.js, by default, operates on a single main thread, which is responsible for executing JavaScript code and handling the event loop. However, it also utilizes a pool of auxiliary threads for handling asynchronous I/O operations. This pool is managed by the libuv library, which Node.js uses to handle file system operations, network requests, and other asynchronous tasks.
The exact number of threads in this pool can vary. By default, libuv creates a thread pool with four threads, but this can be configured to have more or fewer threads depending on the needs of the application. The environment variable UV_THREADPOOL_SIZE can be set before starting the application to change the number of threads in the pool.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.