Questions 37 to 39

Explanations for questions 37 to 39.

We'll cover the following

Question 37

A web application receives order processing information from customers and places the messages on an Amazon SQS queue. A fleet of Amazon EC2 instances is configured to pick up the messages, process them, and store the results in a DynamoDB table. The current configuration has been resulting in a large number of empty responses to ReceiveMessage API requests.

A solutions architect needs to eliminate empty responses to reduce operational overhead. How can this be done?

  1. Use a Standard queue to provide at-least-once delivery, which means that each message is delivered at least once.
  2. Use a FIFO (first-in-first-out) queue to preserve the exact order in which messages are sent and received.
  3. Configure Long Polling to eliminate empty responses by allowing Amazon SQS to wait until a message is available in a queue before sending a response.
  4. Configure Short Polling to eliminate empty responses by reducing the length of time a connection request remains open.

Correct Answer: 3

Explanation: The correct answer is to use Long Polling, which will eliminate empty responses by allowing Amazon SQS to wait until a message is available in a queue before sending a response.

The problem does not relate to the order in which the messages are processed. There are no concerns over messages being delivered more than once, so it doesn’t matter whether you use a FIFO or standard queue.

Long Polling

  • Long Polling uses fewer requests and reduces cost.
  • It eliminates false and empty responses by querying all servers.
  • SQS waits until a message is available in the queue before sending a response.

Short Polling

  • Short Polling does not wait for messages to appear in the queue.
  • It queries only a subset of the available servers for messages (based on weighted random execution).
  • It is the default.
  • ReceiveMessageWaitTime is set to 0.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.