Libuv Thread Pool & Concurrency Lab
Interactive evaluation of UV_THREADPOOL_SIZE worker thread dispatching, multi-process clustering, and worker threads.
Libuv Thread Architecture
UV_THREADPOOL_SIZE & Asynchronous Worker Offloading
V8 Main Thread (Single JS Stack)100% Non-Blocking
Executes all your JavaScript code. When asynchronous fs, crypto, or zlib functions are called, V8 offloads the synchronous blocking C syscall to Libuv and immediately returns.
Main Thread Status: FREE ⚡
Accepting incoming HTTP sockets on epoll...
Libuv Thread Pool (C/C++ Workers)4 Threads
Thread #1
💤 IDLE
Thread #2
💤 IDLE
Thread #3
⚡ RUNNING
Thread #4
⚡ RUNNING
Thread Pool Log: Click "Dispatch 4 Heavy Crypto Tasks" to simulate thread saturation.
Multi-Core Scale Architectures
Node.js Clustering vs Worker Threads
Architecture Diagram:cluster
Primary Master Process (PID: 1000) [Port 3000 IPC Router]
Worker #1 (PID: 1001)
Isolated 64MB RAM
Isolated 64MB RAM
Worker #2 (PID: 1002)
Isolated 64MB RAM
Isolated 64MB RAM
When to Use Which:
Clustering: Web Server Throughput
Ideal for web applications (Express, Fastify, NestJS) where each process independently handles non-blocking HTTP requests across all CPU cores.
Memory Sharing: ❌ No (Use Redis for sessions)