0 votes
in AWS by

You are developing a system that will be sending messages to an SQS queue. Another application will be running on an EC2 Instance that will be used to process the messages.

Which of the following are BEST practices for making COST effective use of the SQS queues? Choose 2 answers from the options given below.

1 Answer

0 votes
by

Answer - B and C.

This is given in the AWS Documentation.

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 AWS SDK for Java.

Note.

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

Because of what is mentioned in the AWS Documentation as best practices, other options are invalid.

For more information on reducing costs for SQS, please refer to the below URL-

https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/reducing-costs.html

To make cost-effective use of SQS queues when sending messages to an EC2 instance for processing, the following two best practices should be followed:

  1. Use Long Polling for SQS Queues: Long polling is a technique that allows the SQS queue to wait for a specified time for messages to arrive in the queue before returning a response. This reduces the number of requests made to the SQS queue, which in turn reduces costs. Long polling also increases the efficiency of the message processing application on the EC2 instance by reducing the amount of idle time between message retrievals. Hence, using long polling is a cost-effective way of managing SQS queues.

  2. Group the SQS API Operations in Batches: When sending messages to an SQS queue, grouping the API operations in batches reduces the number of requests made to the SQS queue, which in turn reduces costs. Batch operations also help to improve message throughput by reducing the time taken to send messages to the queue. Therefore, grouping the SQS API operations in batches is another cost-effective way of managing SQS queues.

Options A and D are incorrect because short polling and single queue operations do not reduce the number of requests made to the SQS queue and are, therefore, not cost-effective.

Hence, the correct answers are B and C.

...