Interview Hub
Sign in

Q21: What is `cluster` or `worker_threads` for?

MidNode.js 29

Answer

cluster forks processes sharing ports (older model for scaling CPU on one machine). worker_threads share memory less freely but allow parallel JS for CPU work without forking whole processes. For IO-bound APIs, horizontal scaling + stateless services often matters more than threads.

Having a tech or coding interview? Check 29 JavaScript & Node.js interview questions.

EditorJavaScript · local only