Amazon SQS Technical FAQs

Articles & Tutorials>Amazon SQS Technical FAQs
This document enumerates some frequently asked questions and trouble-shooting tips for Amazon Simple Queue Service

Details

Submitted By: Ravi@AWS
AWS Products Used: Amazon SQS
Created On: March 25, 2008 6:44 PM GMT
Last Updated: October 8, 2008 10:07 PM GMT

Notes for Newbies:

  1. How do I start using Amazon SQS?
  2. How many queues and messages can I have?
  3. What if I want the messages to be delivered in order?
  4. What is the difference between the message ID and the receipt handle?
  5. Is the message ID globally unique?
  6. I am getting a "Queue Deleted Recently" error. What is wrong?
  7. I am sure that my queue has messages, but a call to ReceiveMessage returned none. What could be the problem?
  8. How much data can I store in a message?
  9. I deleted a message but I received it again later. What gives?
  10. I am getting an HTTP status code 401 AuthFailure. What could be the cause?

Other questions:

  1. Can I reset the message visibility once I have received the message?
  2. How do I peek at a message?
  3. My request failed with a 500 Internal Error/ 503 Service Unavailable error. What's wrong?

Reporting an issue:

  1. My requests are failing. To help me, what information do you need?

How do I start using Amazon SQS?

If you are a beginner and want to get a quick overview of the Amazon Simple Queue Service, an excellent resource to begin with is the Amazon SQS Getting Started Guide and the Amazon SQS Scratchpad (you must have an Amazon Web Services account and be signed up for Amazon SQS before you can start using it).

If you are a developer and would like to get an in-depth understanding of Amazon SQS, the Amazon SQS Developer Guide will provide you all the details about the service. You might also want to take a look at the Code Samples and Developer Forums.

If you are interested in finding out more about how developers have used Amazon SQS in their applications, the Amazon SQS Solutions Catalog provides details of solutions that AWS developers have built using Amazon SQS.


How many queues and messages can I have?

Amazon SQS supports an unlimited number of queues and unlimited number of messages per queue for each user. Please be aware that Amazon SQS automatically deletes messages that have been in the queue for more than 4 days.


What if I want the messages to be delivered in order?

Amazon SQS makes a best effort to preserve order in messages, but due to the distributed nature of the queue, we cannot guarantee that you will receive messages in the exact order you sent them. You typically place sequencing information or timestamps in your messages so that you can reorder them upon receipt.


What is the difference between the message ID and the receipt handle?

The message ID is a unique identifier for the message, whereas a receipt handle is an identifier associated with the act of receiving the message. A new receipt handle is returned every time you receive a message. When deleting a message, you provide the last received receipt handle to delete the message.


Is the message ID globally unique?

Message IDs are considered unique across all AWS accounts for an extended period of time.


I am getting a "Queue Deleted Recently" error. What is wrong?

If you delete a queue, you need to wait for at least 60 seconds before creating a queue with the same name. Please note that when you delete a queue, the deletion process takes up to 60 seconds. Requests you send to a recently deleted queue might succeed during the 60-second period. For example, a SendMessage request might succeed, but after 60 seconds the queue and that message you sent no longer exists.


I am sure that my queue has messages, but a call to ReceiveMessage returned none. What could be the problem?

Due to the distributed nature of the queue, a weighted random set of machines is sampled on a ReceiveMessage call. That means only the messages on the sampled machines are returned. If the number of messages in the queue is small (less than 1000), it is likely you will get fewer messages than you requested. If the number of messages in the queue is extremely small, you might not receive any messages in a particular ReceiveMessage response. Your application should be prepared to poll the queue until a message is received. Note that with the 2008-01-01 version of Amazon SQS, you're charged for each request you make, so set your polling frequency with that in mind.


How much data can I store in a message?

With Amazon SQS version 2008-01-01, the maximum message size for both SOAP and Query requests is 8KB.

If you need to send messages to the queue that are larger than 8 KB, we recommend that you split the information into separate messages. Alternatively, you could use Amazon S3 or Amazon SimpleDB to hold the information and include the pointer to that information in the Amazon SQS message.

If you send a message that is larger than 8KB to the queue, you will receive a MessageTooLong error with HTTP code 400.


I deleted a message, but I received it again later. What gives?

This might happen if you don't provide the most recent receipt handle for the message, in which case the request will still succeed, but the message might not be deleted. It is also possible that on a rare occasion, one of the servers that is holding a copy of the message will be unavailable when you request to delete the message. The copy might be retained on the server and returned to you on a subsequent ReceiveMessage request.

You should design your system to be idempotent so that receiving a particular message more than once is not a problem.


I am getting an HTTP status code 401 AuthFailure. What could be the cause?

The most common cause of authentication failure is an invalid signature.

If you are using Query, make sure that:

  • You have correctly constructed the string to be signed (you can validate the string to be signed using the Amazon SQS Scratchpad).
  • You are passing the correct signature in your request. Some of the common errors while creating the signature include:
    • Wrong time zone (time must be in UTC).
    • Wrong time stamp format. Make sure your format matches: YYYY-MM-DDThh:mm:ssZ, as specified in the ISO 8601 standard. Some toolkits do not provide support for the milliseconds in the formatting. If so, make sure to append "00Z" to the end of the time stamp.
    • Failure to base64 encode the signature.
    • Wrong algorithm used (not HMAC-SHA1).
For a detailed explanation of the request authentication procedure, please consult the Amazon SQS Developer Guide. If you continue to face the issue, kindly post the details on the AWS Developer Forums where the AWS Community is well equipped to answer to your queries.


Can I reset the message visibility once I have received the message?

With version 2008-01-01, the ChangeMessageVisibility action has been removed from Amazon SQS.

We recommend that if you have a system that produces messages that require varying amounts of time to process and delete, you create multiple queues, each with a different visibility timeout setting. Your system can then send all messages to a single queue that, in turn, forwards each message to another queue with the appropriate visibility timeout (based on the expected processing and deletion time for that message)


How do I peek at a message?

With version 2008-01-01, the PeekMessage action has been removed from Amazon SQS. This functionality was used mainly to debug small systems — specifically to confirm a message was successfully sent to the queue or deleted from the queue. To do this with version 2008-01-01, you can log the message ID and the receipt handle for your messages and correlate them to confirm when a message has been received and deleted.


My request failed with a 500 Internal Error / 503 Service Unavailable error. What's wrong?

It is possible to receive a 500 or 503 HTTP status code due to the rare unavailability of an Amazon SQS server. This error is often temporary and subsequent requests would succeed.

Your system should be prepared to retry any request that receives HTTP status code 500 or 503.


My requests are failing. To help me, what information do you need?

In order to effectively troubleshoot issues related to Amazon SQS, we typically need the following information:

  • Request ID
  • Approximate time of your requests
  • Message ID
  • Name of the queue
  • Any error messages or HTTP status codes that you received

Please post your request with the above details to the AWS Developer Forums


©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.