SQS Standard Vs FIFO Queue

SQS Standard Vs FIFO Queue

SQS Standard Vs FIFO queue

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed different monitoring options available in SQS.

https://cloudaffaire.com/sqs-monitoring/

In this blog post, we will discuss Standard vs FIFO queue in SQS. AWS SQS supports two types of queue, standard and FIFO. A standard queue is used for application where the throughput of messages is more important than the ordering of messages. For example, an application for user registration where the order of users registering is not that important than the number of users that can register. Standard is the default SQS queue.

Standard Queue:

  • Support a nearly unlimited number of transactions per second (TPS) per API action.
  • Support “At-Least-Once” message delivery but occasionally more than one copy of a message might be delivered.
  • Support best effort basis ordering of messages.
  • Distributed in nature, stores copies of your messages on multiple servers for redundancy and high availability.
  • Does not support grouping of messages.
  • Does not support content-based deduplication.
  • Used when throughput is more important than ordering.

A FIFO queue, on the other hand, is used for application where the ordering of messages is more important than the throughput of the messages. For example, an application for online shopping checkout where the order (Payment needs to made first) is more important than the throughput of messages. FIFO is not the default queue of SQS and you need to provide additional configuration details to create a FIFO queue.

FIFO Queue:

  • Support high number (3,000 msg/ps with batching and 300 msg/ps without batching) of transactions per second (TPS) per API action.
  • Support “Exactly-Once” message processing in which a message is delivered once and remains available until a consumer processes and deletes it.
  • Support “First-In-First-Out” delivery where the order in which messages are sent and received is strictly preserved.
  • Not distributed in nature.
  • Support grouping of messages.
  • Support content-based deduplication.
  • FIFO queue name must end with the .fifo suffix.
  • Used when ordering is more important than throughput.

Next, we are going to explain the main difference between a Standard and FIFO queue through a demo.

Prerequisites for this demo:

  • An EC2 instance with proper access to SQS.

Step 1: Configure AWS EC2 instance for the demo.

Step 2: Create a python script to perform queuing operations in a Standard queue.

Step 3: Execute the script.

SQS Standard Vs FIFO Queue

Observation: In the case of the standard queue, while receiving messages, messages are not ordered as per ‘SendMessage’ request.

Step 4: Create a python script to perform queuing operations in a FIFO queue.

Step 5: Execute the script.

SQS Standard Vs FIFO Queue

Observation: In the case of the FIFO queue, while receiving messages, messages are ordered as per ‘SendMessage’ request.

Hope you have enjoyed this article. With this, we are ending our introductory series on AWS SQS. In the next blog post, we will start with a new AWS service.

To get more details on AWS SQS, please refer below AWS documentation

https://docs.aws.amazon.com/sqs/index.html

 

Leave a Reply

Close Menu