Recall & Review
beginner
What is a worker in Node.js cluster module?
A worker is a child process created by the cluster module to handle tasks in parallel, improving performance by using multiple CPU cores.
Click to reveal answer
beginner
Why do workers sometimes crash in Node.js applications?
Workers can crash due to unhandled errors, memory leaks, or unexpected exceptions in the code they run.
Click to reveal answer
intermediate
How can you detect when a worker crashes in Node.js cluster?
You listen to the 'exit' event on the worker object. This event fires when a worker stops, including crashes.
Click to reveal answer
intermediate
What is the common way to restart a crashed worker in Node.js?
When a worker exits, the master process creates a new worker to replace it, keeping the app running smoothly.
Click to reveal answer
beginner
Why is it important to restart workers after crashes?
Restarting workers ensures the application stays available and responsive, avoiding downtime caused by crashed processes.
Click to reveal answer
Which Node.js module helps manage multiple worker processes?
✗ Incorrect
The cluster module allows Node.js to create worker processes to use multiple CPU cores.
What event should you listen to detect a worker crash?
✗ Incorrect
The 'exit' event fires when a worker stops, including crashes.
What is the best action after a worker crashes?
✗ Incorrect
Restarting the worker keeps the app running without downtime.
What can cause a worker to crash?
✗ Incorrect
Unhandled exceptions or errors can cause a worker to crash.
Who is responsible for restarting workers in a Node.js cluster?
✗ Incorrect
The master process listens for worker exits and restarts them.
Explain how Node.js cluster handles worker crashes and restarts.
Think about how the master process manages workers.
You got /4 concepts.
Why is it important to monitor and restart workers in a Node.js app?
Consider what happens if a worker crashes and is not restarted.
You got /4 concepts.