AWS SDK Logging and Error Retrying Mechanisms | Exam DVA-C01

AWS SDK Logging and Error Retrying Mechanisms

Prev Question Next Question

Question

A software engineer is developing an application in AWS using AWS SDK.

You need a mechanism implemented in the AWS SDK to deal with "logging" and for "re-trying" the errors.

Which of the following mechanisms is suitable?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

The AWS Documentation mentions the following.

Each AWS SDK implements automatic retry logic.

If you're not using an AWS SDK, you should retry original requests that receive server (5xx) or throttling errors.

However, client errors (4xx) indicate that you need to revise the request to correct the problem before trying again.

In addition to simple retries, each AWS SDK implements an exponential backoff algorithm for better flow control.

The idea behind exponential backoff is to use progressively longer waits between retries for consecutive error responses.

You should implement a maximum delay interval, as well as a maximum number of retries.

Option A is incorrect because it is not a mechanism implemented in AWS SDK.

Option C is incorrect because it does not help to deal with the errors.

Option D is incorrect because it does not deal with the errors rather it is used notify.

For more information on API retries, please refer to the below Link-

https://docs.aws.amazon.com/general/latest/gr/api-retries.html

Option B, the exponential backoff algorithm, is the most suitable mechanism to deal with logging and retrying errors in the AWS SDK.

The exponential backoff algorithm is a mechanism that enables an application to retry an API call that has failed, with an exponentially increasing amount of time between each retry attempt. This approach helps to prevent overloading of the system and improve the chances of success by allowing time for the system to recover from any issues.

For instance, if an AWS SDK API call fails, the application will wait for a short period, then attempt to retry the call. If the second attempt fails, the application will wait for a longer period, then retry again. This process will continue until the call succeeds, or the maximum number of retries is reached.

Option A, multiple SQS queues, is not suitable for this situation. SQS queues are used to decouple and scale microservices, but they are not designed to handle retries.

Option C, for-loop operations, are not suitable either as they do not incorporate any mechanism for error handling or retrying.

Option D, Amazon SNS notifications, is not the best fit for this scenario since SNS is used for push notification and pub/sub messaging rather than retrying failed requests.

Therefore, the best option for logging and retrying errors in the AWS SDK is to use the exponential backoff algorithm.