Amazon Simple Queue Service Case Study

Amazon Simple Queue Service Case Study

What is Amazon Simple Queue Service?

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent.

Amazon SQS is a message queue service used by distributed applications to exchange messages through a polling model and can be used to decouple sending and receiving components.

SQS is a queue from which your services pull data, and it only supports exactly-once delivery of messages. If no workers pull jobs from SQS, the messages stay in the queue. SNS is a publisher-subscriber system that pushes messages to subscribers. If there are no subscribers to an SNS topic, a given message is lost.

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message-oriented middleware and empowers developers to focus on differentiating work. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be available. Get started with SQS in minutes using the AWS console, Command Line Interface or SDK of your choice, and three simple commands.

How does SQS work :-

SQS It is used to decouple various components of the application. To understand in simple terms, it is like buffered storage in between various software components.

No alt text provided for this image

Here is the explanation

There are three main parts to a distributed messaging system: the components of your distributed system, your queue (distributed on Amazon SQS servers), and the messages in the queue.

In the following scenario, your system has several producers (components that send messages to the queue) and consumers (components that receive messages from the queue). The queue (which holds messages A through E) redundantly stores the messages across multiple Amazon SQS servers.

No alt text provided for this image

Message lifecycle

The following scenario describes the lifecycle of an Amazon SQS message in a queue, from creation to deletion.

No alt text provided for this image

Here,

1 = A producer (component 1) sends message A to a queue, and the message is distributed across the Amazon SQS servers redundantly.

2 = When a consumer (component 2) is ready to process messages, it consumes messages from the queue, and message A is returned. While message A is being processed, it remains in the queue and isn't returned to subsequent receive requests for the duration of the visibility timeout.

3 = The consumer (component 2) deletes message A from the queue to prevent the message from being received and processed again when the visibility timeout expires.

Key features of SQS

SQS is a cloud service and can be used by any type of software, application, or another service. SQS works at its own independent service in the cloud. A software connects with SQS using a connection bypassing the credentials and queue names. SQL also allows applications to create and delete custom queues.

  • At-Least-Once Delivery — A message in the queue is delivered at least once. Message delivery is guaranteed, no message is lost.[Text Wrapping Break]
  • Multiple components can work on a single queue. SQS uses a lock mechanism, if one component is using a message, it is made hidden to other components. Upon successful processing, the message is deleted from the queue. If the message processing fails, it stays in the queue and is made visible to all the components. This feature is called Visibility Timeout.
  • There are two types of queues — Standard and FIFO. In a standard queue, the messages are picked up randomly. It might not be in the order it entered the queue while the FIFO queue uses first-in-first-out, it ensures the order.
  • The messages that cannot be processed are kept in a dead-letter queue.
  • Billing is done based on the number of requests to the queue. SQS is a good service to be used for applications to increase efficiency, reliability, and performance.
  • Unlimited queues and messages: Create unlimited Amazon SQS queues with an unlimited number of message in any region
  • Queue Sharing: Securely share Amazon SQS queues anonymously or with specific AWS accounts. Queue sharing can also be restricted by IP address and time-of-day.

Benefits of SQS

  • SQS is easy to set up without any overhead
  • SQL is reliable
  • SQS is secure
  • SQS is scalable and and cost-effective

Pros and Cons

  • Simple to start: SQS is simple to get started with and configure if you are new to using both AWS and if you are new to using this particular service.
  • Pricing: Pricing for SQS is surprisingly less complicated than other services in AWS and is pretty reasonable.
  • Might not be the best solution if you aren't "all in" with AWS: Many AWS services rope you into being all in with AWS. It becomes pretty difficult to implement full solutions using AWS without using their entire stack. SQS is not really any different in that respect.
  • There are free services that can do the same/similar things to SQS that may make it easier to implement outside AWS, or at least in part outside of AWS.

SQS Use Cases

  1. Work Queues

Decouple components of a distributed application that may not all process the same amount of work simultaneously.

2. Buffer and Batch Operations

Add scalability and reliability to the architecture and smooth out temporary volume spikes without losing messages or increasing latency

3. Request Offloading

Move slow operations off of interactive request paths by enqueueing the request.

4. Fan-out

Combine SQS with SNS to send identical copies of a message to multiple queues parallel for simultaneous processing.

5. Auto Scaling

SQS queues can be used to determine the load on an application, and combined with Auto Scaling, the EC2 instances can be scaled in or out, depending on the volume of traffic

Companies using SQS.

No alt text provided for this image


??Hope you enjoyed the article.?

Keep Learning !! Keep Sharing !!







Vinodha Kumara L

Sr DevOps at barq | 2xAWS Certified | 3xAzure Certified | MLOps | Terraform | Ansible | Jenkins | ArgoCD | CloudComputing | K8s | Blogger

4 年

Nice dude

回复

Nice one Suyog Shinde

回复

要查看或添加评论,请登录

Suyog Shinde的更多文章

社区洞察

其他会员也浏览了