← Back to problems

28. Background Email Sender

EASY
Async ProcessingEasyMessage QueueSystem Design

Design a system that accepts a request to send an email and hands the slow delivery work to a background queue so the user is not kept waiting.

Design a backend that sends emails, for example a welcome email on signup. Sending an email is slow and can fail, so doing it inline while the user waits makes the request hang and couples the response to an external mail provider. The one idea this design introduces is a message queue for background work: the application server accepts the send request, puts a job on a queue, and immediately responds to the user. Separate worker servers pull jobs off the queue and actually send the emails, retrying on failure, without the user ever waiting on them. Build on the basic web-app shape and add a queue between the request and the slow work. Lay out the architecture, then document the API and the trade-offs of doing work asynchronously, such as the delay between accepting a request and the email actually going out.
Log in to submit a solution

Comments

Log into join the discussion.