Managing Long Running Tasks hard
How do you detect if a worker has silently hung (frozen) while processing a task, rather than crashed?
- A Ping it.
- B The worker must periodically send a 'Heartbeat' or renew its 'Lease' on the task. If the heartbeat stops (lease expires), the coordinator re-queues the task for another worker.
- C Restart the server.
- D Check CPU usage.
Answer: B. The worker must periodically send a 'Heartbeat' or renew its 'Lease' on the task. If the heartbeat stops (lease expires), the coordinator re-queues the task for another worker.
Essential for robust systems. A crashed process releases socket/lock (OS level), a hung process holds them.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What is the primary purpose of a Dead Letter Queue (DLQ)?
- The architectural pattern where one service creates tasks and another processes them is called:
- In a Priority Queue system (High vs Low), what is 'Starvation' and how do you fix it?
- How do you atomically update your local database AND publish a message to a queue without losing sync if the process crashes in between?
- What does 'Fire and Forget' mean?
- Why might you 'Throttle' (limit the speed of) your background workers?