Cloud Fundamentals Course
Cloud Fundamentals
/
Advanced

Message Queue (SQS / Service Bus)

Definition

A distributed message queuing service that enables the decoupling of microservices. It temporarily stores messages generated by one service until another service is ready to process them.

Explain Like I'm New

The ticket dispenser at a busy deli. Instead of customers yelling at the deli worker all at once (crashing the worker), customers take a ticket (a message). The worker takes the tickets one at a time at their own pace.

Real World Example

AWS SQS, Azure Service Bus, GCP Pub/Sub. Users upload 10,000 photos to a website in 1 minute. The photo-resizing server would crash trying to do them all at once. Instead, the uploads are put into an SQS Queue. The resizing server pulls 5 photos from the queue, resizes them, and then pulls 5 more, ensuring it never crashes.

Common Use Cases

  • •Decoupling microservices
  • •Buffering traffic spikes
  • •Asynchronous processing

Interview Questions

basic

  • Does a Message Queue generally process data Synchronously (immediate response required) or Asynchronously (background processing)?

intermediate

  • What is the difference between a Standard Queue and a FIFO Queue?

Flash Cards

Question

Sync or Async?

Click to reveal answer
Answer

Asynchronously. The sender drops the message in the queue and immediately moves on, without waiting for the receiver to finish processing it.

Question

Standard vs FIFO?

Click to reveal answer
Answer

A Standard Queue guarantees 'at-least-once' delivery, but might accidentally deliver messages out of order. A FIFO (First-In-First-Out) Queue strictly guarantees the messages are processed in the exact mathematical order they arrived, which is critical for financial transactions.