System Design · Senior · Question 5 of 75

Why put a message queue between the API and a heavy-task worker?

Explanation

The API quickly accepts the request and enqueues a task (report generation, video processing), and workers process it at their own pace. Load spikes are smoothed out, and a worker failure doesn't lose the task. The client learns the result via status polling, SSE or a notification.

Further reading

Problem with a question

System Design · Senior · question 5

Test yourself

Take the System Design · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz