Jump to content

Amazon Simple Queue Service

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Azarboon (talk | contribs) at 01:14, 22 March 2025. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Amazon Simple Queue Service
Developer(s)Amazon.com
LicenseProprietary software
Websiteaws.amazon.com/sqs/

Amazon Simple Queue Service (Amazon SQS) is a distributed message queuing service introduced by Amazon.com as a beta in late 2004, and generally available in mid 2006.[1][2] It supports programmatic sending of messages via web service applications as a way to communicate over the Internet. SQS is intended to provide a highly scalable hosted message queue that resolves issues arising from the common producer–consumer problem or connectivity between producer and consumer.

Amazon SQS can be described as commoditization of the messaging service. Well-known examples of messaging service technologies include IBM WebSphere MQ and Microsoft Message Queuing. Unlike these technologies, users do not need to maintain their own server. Amazon does it for them and sells the SQS service at a per-use rate.

API

Amazon provides SDKs in several programming languages, including:[3]

A Java Message Service (JMS) 1.1 client for Amazon SQS was released in December 2014.[citation needed]

Comparison with Other Messaging Systems

Amazon SQS FIFO and Azure Service Bus sessions are queue-based messaging systems that provide ordering guarantees within a message group or session attempt but do not necessarily guarantee ordered delivery in cases of retries or failures. In SQS FIFO, messages in the same message group are processed in order, with subsequent messages held until the preceding message is successfully processed or moved to the dead-letter queue (DLQ). Once a message is placed in the DLQ, it is no longer retried, creating a gap in the sequence. However, the remaining messages continue to be delivered in order.[4][5][6]

Azure Service Bus sessions function similarly by maintaining ordering within a session, provided a single consumer processes messages sequentially. The implementation differs from SQS FIFO but follows the same fundamental ordering principle. [7][8]

In contrast, Apache Kafka is a distributed log-based messaging system that guarantees ordering within individual partitions rather than across the entire topic. Unlike queue-based systems, Kafka retains messages in a durable, append-only log, allowing multiple consumers to read at different offsets. Kafka uses manual offset management, giving consumers control over retries and failure handling. If a consumer fails to process a message, it can delay committing the offset, preventing further progress in that partition while other partitions remain unaffected. This partition-based design enables fault isolation and parallel processing while allowing ordering to be maintained within partitions, depending on consumer handling.[9]

Authentication

Amazon SQS provides authentication procedures to allow for secure handling of data. Amazon uses its Amazon Web Services (AWS) identification to do this, requiring users to have an AWS enabled account with Amazon.com. AWS assigns a pair of related identifiers, your AWS access keys, to an AWS enabled account to perform identification. The first identifier is a public 20-character Access Key. This key is included in an AWS service request to identify the user. If the user is not using SOAP with WS-Security, a digital signature is calculated using the Secret Access Key. The Secret Access Key is a 40-character private identifier. AWS uses the Access Key ID provided in a service request to look up an account's Secret Access Key. Amazon.com then calculates a digital signature with the key. If they match then the user is considered authentic, if not then the authentication fails and the request is not processed.

Message delivery

Amazon SQS guarantees at-least-once delivery. Messages are stored on multiple servers for redundancy and to ensure availability. If a message is delivered while a server is not available, it may not be removed from that server's queue and may be resent. As of 2007, Amazon SQS does not guarantee that the recipient will receive the messages in the order they were sent by the sender. If message ordering is important, it is required that the application place sequencing information within the messages to allow for reordering after delivery.

Messages can be of any type, and the data contained within is not restricted. Message bodies were initially limited to 8KB in size but was later raised to 64KB on 2010-07-01[10] and then 256KB on 2013-06-18.[11] For larger messages, the user has a few options to get around this limitation. A large message can be split into multiple segments that are sent separately, or the message data can be stored using Amazon Simple Storage Service (Amazon S3) or Amazon DynamoDB with just a pointer to the data transmitted in the SQS message. Amazon has made an Extended Client Library available for this purpose.[12]

The service supports both unlimited queues and message traffic.

Message deletion

SQS does not automatically delete messages once they are sent. When a message is delivered, a receipt handle is generated for that delivery and sent to the recipient. These receipts are not sent with the message but in addition to it. SQS requires the recipient to provide the receipt in order to delete a message. This feature is new as of 2008 where only the message ID was required for message deletion. Because the system is distributed, a message may be sent more than once. In this case, the most recent receipt handle is needed to delete the message. Furthermore, the receipt handle may have other validity constraints; for instance, the receipt handle may only be valid during the visibility timeout (see below).

Once a message is delivered, it has a visibility timeout to prevent other components from consuming it. The "clock" for the visibility timeout starts once a message is sent, the default time being 30 seconds. If the queue is not told to delete the message during this time, the message becomes visible again and will be present.

Each queue also consists of a retention parameter defaulting to 4 days. Any message residing in the queue for longer will be purged automatically. The retention can be modified from 1 minute up to 14 days by the user. If the retention is changed while messages are already in the queue, any message that has been in the queue for longer than the new retention will be purged.

Notable usage

Examples of companies that use SQS extensively include:

See also

References

  1. ^ "Amazon Simple Queue Service Released". Amazon Web Services. 2006-07-13. Retrieved 2021-10-29.
  2. ^ Barr, Jeff (2014-08-19). "My First 12 Years at Amazon.com". jeff-barr.com. Retrieved 2021-01-11.
  3. ^ AWS (2024). "AWS SDKs and Tools". Retrieved 2024-05-29.
  4. ^ "FIFO queue delivery logic in Amazon SQS - Amazon Simple Queue Service". docs.aws.amazon.com. Retrieved 2025-03-22.
  5. ^ "Using dead-letter queues in Amazon SQS - Amazon Simple Queue Service". docs.aws.amazon.com. Retrieved 2025-03-22.
  6. ^ "Amazon SQS FIFO queues - Amazon Simple Queue Service". docs.aws.amazon.com. Retrieved 2025-03-22.
  7. ^ spelluru (2025-03-21). "Azure Service Bus message sessions - Azure Service Bus". learn.microsoft.com. Retrieved 2025-03-22.
  8. ^ spelluru (2025-02-07). "Service Bus dead-letter queues - Azure Service Bus". learn.microsoft.com. Retrieved 2025-03-22.
  9. ^ Narkhede, Neha; Shapira, Gwen; Palino, Todd (2017). Kafka: the definitive guide: real-time data and stream processing at scale (First edition ed.). Sebastopol, CA: O'Reilly Media. ISBN 978-1-4919-3616-0. OCLC 933521388. {{cite book}}: |edition= has extra text (help)
  10. ^ "Amazon SQS introduces Free Tier and adds Support for Larger Messages and Longer Retention". aws.amazon.com. 2010-07-01. Retrieved 2021-01-11.
  11. ^ "Amazon SQS and SNS Announce 256KB Large Payloads". aws.amazon.com. 2013-06-18. Retrieved 2021-01-11.
  12. ^ An extension to the Amazon SQS client that enables sending and receiving messages up to 2GB via Amazon S3. on GitHub
  13. ^ Amazon Web Services (2014-11-14). AWS re:Invent 2014 | (PFC308) How Dropbox Scales Massive Workloads Using Amazon SQS. Retrieved 2024-12-07 – via YouTube.
  14. ^ Granqvist, Hans (2011-04-18). ""More Like This…" Building a network of similarity". Netflix Tech Blog. Archived from the original on 2016-11-28.
  15. ^ Fang, Wenbin (2014-08-13). "Nextdoor Taskworker: Simple, Efficient & Scalable". Nextdoor Engineering.
  16. ^ "Amazon SQS FAQs | Message Queuing Service | AWS". Amazon Web Services, Inc. Retrieved 2024-12-07.