Use Cases of AWS SQS

Akurathi Sri Krishna Sagar
4 min readSep 26, 2021

What is Amazon SQS service ?

Amazon Simple Queue Service (SQS) is a distributed message queuing service introduced in late 2004. It supports programmatic sending of messages via web service applications as a way to communicate over the Internet. Messages can contain up to 256 KB of text in any format such as json, xml, etc.

SQS enables you to decouple and scale microservices, distributed systems, and server less 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.

SQS offers two types of message queues. Standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery. SQS FIFO queues are designed to guarantee that messages are processed exactly once, in the exact order that they are sent.

Benefits of using Amazon SQS

Eliminate administrative overhead

With SQS, there is no upfront cost, no need to acquire, install, and configure messaging software, and no time-consuming maintenance of supporting infrastructure. SQS queues are dynamically created and scale automatically so you can build and grow applications quickly and efficiently.

Reliably deliver messages

SQS lets you decouple application components so that they run and fail independently, increasing the overall fault tolerance of the system. Multiple copies of every message are stored redundantly across multiple availability zones so that they are available whenever needed.

Keep sensitive data secure

You can use Amazon SQS to exchange sensitive data between applications using server-side encryption (SSE) to encrypt each message body. Amazon SQS SSE integration with AWS Key Management Service (KMS) allows you to centrally manage the keys that protect SQS messages.

Scale elastically and cost-effectively

SQS scales elastically with your application so you don’t have to worry about capacity planning and pre-provisioning. There is no limit to the number of messages per queue, and standard queues provide nearly unlimited throughput.

What if we don’t have Amazon SQS ?

A web server passes the information to an application server and then application server queried an Airline service. If an Application server crashes, then a user loses its query.

One of the great thing about SQS is that data is queued in the SQS even if the application server crashes, the message in the queue is marked as an invisible in a timeout interval window. When the timeout runs out, message reappears in the queue; then a new EC2 instance can use this message to perform its job. Therefore, we can say that SQS removes the application server dependency.

Queue Types of Amazon SQS

Standard Queue :

  • SQS offers a standard queue as the default queue type.
  • It allows you to have an unlimited number of transactions per second.
  • It guarantees that a message is delivered at least once. However, sometime, more than one copy of a message might be delivered out of order.
  • It provides best-effort ordering which ensures that messages are generally delivered in the same order as they are sent but it does not provide a guarantee.

FIFO Queue :

  • The FIFO Queue complements the standard Queue.
  • It guarantees ordering, i.e., the order in which they are sent is also received in the same order.
  • The most important features of a queue are FIFO Queue and exactly-once processing, i.e., a message is delivered once and remains available until consumer processes and deletes it.
  • FIFO Queue does not allow duplicates to be introduced into the Queue.
  • It also supports message groups that allow multiple ordered message groups within a single Queue.
  • FIFO Queues are limited to 300 transactions per second but have all the capabilities of standard queues.

SQS Visibility Timeout

  • The visibility timeout is the amount of time that the message is invisible in the SQS Queue after a reader picks up that message.
  • If the provided job is processed before the visibility time out expires, the message will then be deleted from the Queue. If the job is not processed within that time, the message will become visible again and another reader will process it. This could result in the same message being delivered twice.
  • The Default Visibility Timeout is 30 seconds.
  • Visibility Timeout can be increased if your task takes more than 30 seconds.
  • The maximum Visibility Timeout is 12 hours.

Properties of Amazon SQS :

  • SQS is pull-based, not push-based.
  • Messages can be 256 KB in size.
  • Messages are kept in a queue from 1 minute to 14 days.
  • The default retention period is 4 days.
  • It guarantees that your messages will be processed at least once.

Thanks for Reading.

--

--