Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question

You must login to ask a question.


Register Now

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Morbi adipiscing gravdio, sit amet suscipit risus ultrices eu.Fusce viverra neque at purus laoreet consequa.Vivamus vulputate posuere nisl quis consequat.

Besides cost optimization, when would using SQS in between make the most sense?

# When to use SQS between services instead of direct integration

There are a few scenarios where using SQS as a message queue between services is preferable to direct integration:

  1. Decoupling services – SQS allows services to communicate without having a direct dependency on each other. If Service A connects directly to Service B, then any downtime or change in Service B will affect Service A. By using SQS as an intermediary, Service A only depends on the queue, not Service B. This decouples the services and makes them more resilient.
  2. Handling load spikes – SQS can act as a buffer, absorbing load spikes from one service and delivering the messages to the other service at a steady rate. If Service A experiences a sudden increase in load, it can place messages in the queue. Service B can then poll the queue and process messages at a steady rate, without being overwhelmed.
  3. Rate limiting SQS allows the consuming service to control the rate at which it receives and processes messages. This can help limit the load on downstream databases or APIs.
  4. Back pressure – If the consuming service is unable to keep up with the producer, messages will accumulate in the queue. This provides “back pressure” and signals to the producer to slow down.
  5. Retrying messagesSQS provides features for retrying failed messages, including exponential backoff and dead letter queues. This allows messages to eventually be processed, even after transient failures.
  6. Asynchronous communication – SQS enables asynchronous communication between services. The producer can continue its work after placing a message in the queue, without waiting for an acknowledgement from the consumer.
ALSO READ  Master AWS DocumentDB: Key Interview Questions Explained

In summary, using SQS as a message queue between services provides many benefits like decoupling, load management, rate limiting, retrying, and asynchronous communication. The key is that SQS acts as a buffer, absorbing differences in load and processing rates between the producer and consumer services.



About Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

Follow Me

Leave a reply