InterviewBuddy
All interview questions

When should a Node.js service use worker threads?

Advanced

Answer

Use worker threads for expensive JavaScript computation that benefits from parallel execution. Ordinary asynchronous I/O usually does not need them.

Explanation

A reusable worker pool avoids creating a thread for each small task.

Example

Main thread accepts requests; workers perform CPU-heavy calculations.