Cloud queues · core
SQS standard and FIFO queues, and polling cost
Standard queues give high throughput with at-least-once delivery and best-effort order. FIFO queues give order per message group. Polling style decides your bill.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Standard: nearly unlimited throughput, at-least-once delivery (rare duplicates), best-effort order.
- FIFO: strict order within a message group (MessageGroupId). Duplicate sends are removed within a 5-minute deduplication interval. While one message of a group is in flight, the rest of that group waits.
- FIFO has lower throughput limits than standard, so spread load over many group ids. One group id for the whole queue makes everything run one at a time.
- Example: wallet balance updates, FIFO with the user id as the group id; thumbnails, standard with idempotent work; a mass SMS, standard with throttling and a deduplication check in the consumer.
- FIFO deduplication covers repeated sends, not a consumer that crashes after writing and before deleting. The handler must still be idempotent.
- SQS charges per API request, and an empty receive is a request too.
- Short polling returns at once even when empty and checks only a subset of servers. Long polling waits up to 20 seconds and queries all servers, so it gives fewer empty responses and a lower cost.
- Receive up to 10 messages per call and delete in batches. Scale workers on queue depth and the age of the oldest message, with a sensible minimum.
The red pen
Common traps: mistake → fix
Mistake: FIFO means no duplicates ever
Fix: only within the deduplication interval for sends.
Mistake: FIFO everywhere to be safe
Fix: it limits throughput and needs good group ids.
Mistake: SQS is cheap, ignore the bill
Fix: short polling loops can make millions of empty calls.
Mistake: A sleep in the loop replaces long polling
Fix: it adds delay and still wastes calls.
Easy to hard
Questions interviewers ask, easy to hard
- Standard or FIFO for wallet updates, thumbnails and a mass SMS?
- Our SQS bill went up eight times with flat traffic. Why?
- What does MessageGroupId do?
- What is long polling?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.