Message queues and workers
Doing work later, without making the user wait: producers, consumers, acknowledgements, dead letters, at-least-once delivery and idempotency.
- 35 cards
- 3 topics
- Free
The outline, topic by topic
Each topic is weighted the way the exam weighs it.
- Concepts
- Scenarios
- Trade-offs and failures
A few cards from the deck
Message queue: what is it?
Show the answer
A buffer where producers drop messages that consumers process later.
Slow or bursty work is decoupled from the user's request.
Sending the confirmation email makes sign-up take three seconds. What do you do?
- Put the sending in a queue handled by a worker
- A faster server
- An email cache
- Lengthen the timeout
Show the answer
Put the sending in a queue handled by a worker
The user gets their answer at once; the email goes out right after.
Producer: what is it?
Show the answer
A component that sends messages into the queue.
It does not wait for the work to be done.
What is the drawback of asynchronous processing for the user?
- They do not get the result at once, and failures are handled later
- The page is slower
- Data is lost
- They must stay online
Show the answer
They do not get the result at once, and failures are handled later
The work's status must be tracked and the user told on failure.