Reducing Amazon SQS costs - Amazon Simple Queue Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Reducing Amazon SQS costs

The following best practices can help you reduce costs and take advantage of additional potential cost reduction and near-instantaneous response.

Batching message actions

To reduce costs, batch your message actions:

  • To send, receive, and delete messages, and to change the message visibility timeout for multiple messages with a single action, use the Amazon SQS batch API actions.

  • To combine client-side buffering with request batching, use long polling together with the buffered asynchronous client included with the Amazon SDK for Java.

    Note

    The Amazon SQS Buffered Asynchronous Client doesn't currently support FIFO queues.

Using the appropriate polling mode

  • Long polling lets you consume messages from your Amazon SQS queue as soon as they become available.

    • To reduce the cost of using Amazon SQS and to decrease the number of empty receives to an empty queue (responses to the ReceiveMessage action which return no messages), enable long polling. For more information, see Amazon SQS Long Polling.

    • To increase efficiency when polling for multiple threads with multiple receives, decrease the number of threads.

    • Long polling is preferable over short polling in most cases.

  • Short polling returns responses immediately, even if the polled Amazon SQS queue is empty.

    • To satisfy the requirements of an application that expects immediate responses to the ReceiveMessage request, use short polling.

    • Short polling is billed the same as long polling.