Bird
0
0

What happens if you fork more workers than CPU cores in a Node.js app using cluster?

medium📝 component behavior Q5 of 15
Node.js - Cluster Module
What happens if you fork more workers than CPU cores in a Node.js app using cluster?
AWorkers compete for CPU, causing context switching and possible slowdown
BExtra workers are ignored and not created
CApp crashes immediately due to overload
DWorkers run faster because of more parallelism
Step-by-Step Solution
Solution:
  1. Step 1: Understand CPU core limits

    Each CPU core can run one thread at a time; more workers than cores cause switching overhead.
  2. Step 2: Effect of too many workers

    Extra workers cause CPU to switch tasks rapidly, which can slow down performance instead of speeding it up.
  3. Final Answer:

    Workers compete for CPU, causing context switching and possible slowdown -> Option A
  4. Quick Check:

    Too many workers = D [OK]
Quick Trick: Match workers to CPU cores to avoid slowdowns [OK]
Common Mistakes:
  • Thinking extra workers are ignored
  • Assuming app crashes with extra workers
  • Believing more workers always speed up

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes