Java – API retry logic in Amazon Web Services

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

This document mentions that "each AWS SDK implements automatic retry logic, and AWS SDK for Java automatically retries requests"

If I do not specify any retry configuration, what is the default mechanism of the Java AWS SDK? If the AWS server fails, I have been using the Java AWS SDK and get simple service exceptions I have never experienced any "automatic" retry mechanism Can anyone explain what this retry mechanism is?

Solution

The same document page says:

You should check the official documentation of client configuration, which has many ways to adjust its behavior about retry logic This is the most important:

>Withmaxerrorretry sets the maximum number of retries for failed retrieable requests (e.g. 5xx error response from the service) > withrequesttimeout sets the waiting time (in milliseconds) to complete the request before abandonment and timeout [...] > withthrottledretries retry limit function can intelligently limit retry attempts [...] when most requests fail and retry fails >Withretrypolicy this is the most interesting. It allows you to select retrypolicy and change it:

>Backoffstrategy hook for providing custom backoff policies to control the sleep time between retries > retrycondition hook for providing custom conditions for whether failed requests should be retried > maxerrorretry > honormaxrerrorretryinclientconfig (whether to comply with the above configuration settings)

Also note that if you do not notice the automatic retry mechanism, it may be due to a client error These settings are only used to retry requests in case of server (5xx) or restriction errors:

If you claim that it is a "server" failure, you should provide some code to reproduce the situation and analyze the actual situation

Now about defaults:

You can find the default value of clientconfiguration constant fields However, please note that it may vary depending on the service you use (especially dynamodb is a special case) See also the predefined clientconfigurations and predefined retrypolicies courses

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>