What is Amazon Simple Queue Service | Introduction to AWS queue service

Think. Build. Salesforce Solutions.

Salesforce Consulting Services across Salesforce Clouds & Across App Lifecycles

Blog

Amazon Simple Queue Service: Overview

By |2020-07-20T10:59:07+00:00March 12th, 2019|Tags: , , , |

With modern cloud architecture applications are now decoupled into smaller, independent building blocks that are easier to develop, deploy and maintain, but the applications should also deal with connecting system components for the seamless flow of information among these components.
amazon simple queue service

The message queue is a powerful way of combining application components. Message queue not only simplifies the coding of decoupled applications, but it also improves performance, reliability, and scalability.
Message queues allow different parts of a system to communicate (send and receive messages) and process operations asynchronously by providing a lightweight buffer to store messages, and endpoints temporarily. A message is sent to the queue by a component called a producer and it is stored in the queue until another component called a consumer retrieves the message and processes it.

amazon simple queue service
This messaging pattern is often called one-to-one, or point-to-point, communications because many producers and consumers can use the queue, but each message is processed only once, by a single consumer.

What is Amazon SQS?

Amazon Simple Queue Service (SQS) is a secure, durable, fully managed, and available hosted queue that offers to integrate and decouple distributed software systems and components by allowing transmitting data between distributed application components. SQS eliminates the complexity and burden associated with managing and operating message-oriented middleware and empowers developers to focus on differentiating work. Using SQS, messages can be sent, stored, and received between software components at any volume, without losing messages or requiring other services to be available.

Use cases-Application integration, Allocation of tasks to multiple worker nodes, Decouple live user requests from intensive background work, Decoupling microservices, Batch messages for future processing
An Amazon SQS message has three basic states:

  1. Sent to a queue by a producer
  2. Received from the queue by a consumer and
  3. Deleted from the queue.

Between state 1 and state 2, the message is stored in a queue and available for use while in between in state 2 and state 3, the message is in flight and not available for use for the other consumers.

When a consumer receives and processes a message from a queue, Amazon SQS doesn’t delete the message automatically because SQS is a part of a distributed system, there’s no guarantee that the consumer receives the message (for example, due to a connectivity issue, or due to an issue in the consumer application). This needs to be done by the event handler function at the consumer’s side after receiving and processing the message. If the message is not deleted during the defined period (called visibility timeout), the message becomes again visible for the other consumers

Benefits of Amazon SQS

  • Administrative overhead– It eliminates administrative overhead and AWS SQS will manage all the operations that are currently underway and infrastructure which is required to scale and run a message queuing. There is no requirement to install and configure messaging software as well as maintenance of infrastructure.
  • Security-Amazon SQS can be used to exchange sensitive data between applications using server-side secret writing (SSE) that offers to transmit sensitive data by protecting the contents of messages in queues using keys managed in AWS Key Management Service (AWS KMS). It also allows controlling who can send messages to and receive messages from an Amazon SQS queue.
  • Durability “ To ensure the safety of your messages, Amazon SQS stores them on multiple servers though only for a limited. (Max.- 14 days)
  • Availability “ Amazon SQS stores data on different servers and uses redundant infrastructure to provide highly-concurrent access to messages.
  • Scalability “ Amazon SQS allows to dynamically increase read throughput by scaling the number of tasks reading from a queue and requires no pre-provisioning or scale-out of AWS resources. It easily scales to handle a large volume of messages, without user intervention. SQS buffers requests to transparently handle an increase in load.
  • Reliability “ It locks your messages during processing so that a message is consumed only once by a single consumer. It also enables multiple producers can send and multiple consumers can receive messages at the same time.
  • Customization “ Amazon SQS allows customization in multiple ways, from modifying the queue attributes to integrate with other AWS services in an order to build scalable and more flexible applications. It is compatible with other Amazon Web Services, including Amazon Relational Database Service, Amazon Elastic Compute Cloud, and Amazon Simple Storage Service.

Amazon SQS queues

Amazon SQS offers the following two types of queues:

1. Standard Queue

  • Availability in regions-All regions.
  • Unlimited Throughput “Supports a nearly unlimited number of transactions per second (TPS) per action.
  • At-Least-Once Delivery “ It guarantees a message to be delivered at least once. SQS stores copies of messages on multiple servers for high availability and redundancy. On rare occasions, the copy of the message isn’t deleted on any of the servers might be due to the unavailability of that server during deletion. This may result in the message delivered more than once.
  • Use Case– It can be used in any scenarios, as long as the application can handle messages which might be out of order or duplicate
  • Best-Effort Ordering “ A standard queue makes a best effort to preserve the order of messages, but occasionally, messages might be delivered in an order different from which they were sent

amazon simple queue service

2. FIFO Queue

  • Availability in regions– US East (Ohio), Asia Pacific (Tokyo), US East (N. Virginia), US West (N. California), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Mumbai), Canada (Central), US West (Oregon), EU (Frankfurt), EU (Ireland), EU (London), EU (Paris), and South America (São Paulo) regions.
  • The name must end with the .fifo
  • High Throughput “FIFO queues support up to 3,000 messages per second with batching. FIFO queues support up to 300 messages per second, per action (SendMessage, ReceiveMessage, or DeleteMessage) without batching.
  • Exactly-Once Processing “ A message is delivered once and remains available until a consumer process and deletes it. Duplicates aren’t introduced into the queue.
  • Use Case-Designed to enhance messaging between applications when the order of operations and events is critical, or where duplicates can’t be permitted.
  • First-In-First-Out Delivery “ The order of the messages in which messages are sent and received is maintained.

amazon simple queue service

Conclusion

Message queue plays an important role in a distributed system for communication and coordination among components. As you saw Amazon provides one such service called Amazon SQS which is intended to provide a highly scalable hosted message queue. Apart from the benefits, it provides like scalability, security, etc, it also provides two types of queue well-suited for different use cases.

Leave A Comment