AWS, Azure & GCP · Cloud across providers
Why use a message queue in cloud architecture?
Short answer
A queue decouples producers from consumers, buffers bursts, and lets consumers retry independently. It improves resilience and smooths load, at the cost of eventual consistency, duplicate delivery and operational complexity.
A queue sits between a producer and a consumer. The producer writes a message and moves on; the consumer processes at its own rate. That absorbs spikes, isolates failures and lets you add consumers without changing the producer.
Delivery semantics
- At-most-once: a message may be lost but is never delivered twice
- At-least-once: a message is never lost but may be delivered more than once, so consumers must be idempotent
- Exactly-once: expensive and usually limited to a specific broker or processing model
- Visibility timeout: how long a consumer holds a message before it becomes visible again
- Dead-letter queue: captures messages that repeatedly fail so they do not loop forever
await sqs.sendMessage({
QueueUrl: queueUrl,
MessageBody: JSON.stringify(order),
MessageAttributes: {
eventType: { DataType: "String", StringValue: "order.created" },
},
}).promise();Queues change the failure model. The UI may accept a request before the work is done, so you need status tracking or optimistic UI. Poison messages, duplicate processing and out-of-order delivery need explicit handling.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What does at-least-once delivery require from a consumer?
- 2How does a visibility timeout work?
- 3When would you need FIFO ordering?
- 4What should happen to a message that repeatedly fails?
Say it in the interview
A queue decouples producers from consumers and buffers bursts, so each side can fail or scale independently. Most queues are at-least-once, which means consumers must be idempotent, and I add a dead-letter queue for poison messages. The trade-off is eventual consistency and more moving parts, so I do not use a queue as the system of record.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AWS, Azure & GCP mock interview and get scored feedback on depth, clarity and confidence.