System Design · Senior · Question 41 of 75
How do you deliver the result of a heavy operation (a 5-minute report export)?
- ✓Correct answer: Accept the job (202 Accepted), process it in the background and notify when ready
- 2Keep the HTTP request open for all 5 minutes until the file is ready
- 3Ask the user not to close the tab and wait
Explanation
The server returns a job id, and the client tracks status (polling, SSE) or gets a notification with a link to the file in storage. Long HTTP requests get cut off by proxies and load balancers and scale poorly.