Skip to content

QuizNot attempted

What uses the thread pool?

Which operations run on libuv's thread pool (4 threads by default)?

Select all that apply.

1–4 to choose, Enter to submit
Show answer & explanation

Correct answers:

  • Most fs file operations
  • crypto.pbkdf2 / crypto.randomBytes and zlib compression
  • dns.lookup
  • libuv's pool handles work the OS can't do asynchronously: most fs operations, CPU-heavy crypto (pbkdf2, randomBytes, scrypt), zlib, and dns.lookup (it calls the blocking getaddrinfo).
  • Not TCP/HTTP socket I/O: network sockets use the OS's non-blocking mechanisms (epoll/kqueue/IOCP) directly on the main loop.
  • Raise UV_THREADPOOL_SIZE if many pool tasks run concurrently.