javav2/example_code/dynamodb/adaptive_retry_docs/configuration-reference.md
This document provides a comprehensive reference for all configuration parameters available in AWS Java SDK's AdaptiveRetryStrategy. Each parameter is documented with its purpose, default values, recommended ranges, and performance implications to help you optimize retry behavior for your specific use case.
Purpose: Sets the maximum number of retry attempts for failed requests.
Type: int
Default Value: 3
Recommended Range: 1-10
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.maxAttempts(5)
.build();
Purpose: Defines the initial delay before the first retry attempt.
Type: Duration
Default Value: Duration.ofMillis(100)
Recommended Range: 50ms - 1000ms
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.baseDelay(Duration.ofMillis(200))
.build();
Purpose: Sets the maximum delay between retry attempts, preventing exponential backoff from growing indefinitely.
Type: Duration
Default Value: Duration.ofSeconds(20)
Recommended Range: 1s - 60s
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.maxBackoffTime(Duration.ofSeconds(30))
.build();
Purpose: Enables or disables the adaptive behavior that learns from success/failure patterns.
Type: boolean
Default Value: true
Recommended Range: true (recommended), false (for debugging)
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.adaptiveMode(true)
.build();
Purpose: Enables detection and special handling of throttling errors.
Type: boolean
Default Value: true
Recommended Range: true (recommended for most use cases)
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.throttlingDetection(true)
.build();
Purpose: Number of consecutive successful requests needed to reduce retry aggressiveness.
Type: int
Default Value: 5
Recommended Range: 3-10
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.successThreshold(7)
.build();
Purpose: Number of consecutive failures needed to increase retry aggressiveness.
Type: int
Default Value: 3
Recommended Range: 2-8
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.failureThreshold(4)
.build();
Purpose: Enables adaptive rate limiting based on observed service capacity.
Type: boolean
Default Value: false
Recommended Range: true for high-throughput applications, false for low-volume use cases
Performance Impact:
Example:
AdaptiveRetryStrategy.builder()
.adaptiveRateLimit(true)
.build();
AdaptiveRetryStrategy.builder()
.maxAttempts(5)
.baseDelay(Duration.ofMillis(50))
.maxBackoffTime(Duration.ofSeconds(10))
.adaptiveMode(true)
.throttlingDetection(true)
.adaptiveRateLimit(true)
.successThreshold(3)
.failureThreshold(2)
.build();
AdaptiveRetryStrategy.builder()
.maxAttempts(8)
.baseDelay(Duration.ofMillis(200))
.maxBackoffTime(Duration.ofSeconds(60))
.adaptiveMode(true)
.throttlingDetection(true)
.successThreshold(5)
.failureThreshold(4)
.build();
AdaptiveRetryStrategy.builder()
.maxAttempts(3)
.baseDelay(Duration.ofMillis(100))
.maxBackoffTime(Duration.ofSeconds(5))
.adaptiveMode(true)
.throttlingDetection(true)
.successThreshold(4)
.failureThreshold(3)
.build();
When tuning your AdaptiveRetryStrategy configuration, monitor these key metrics:
Reference: Amazon CloudWatch Metrics for DynamoDB [12] and "The Tail at Scale" [10]
Reference: AWS Architecture Center - Reliability Pillar [6]
❌ Don't: Set maxAttempts too high (>10) without considering timeout implications ❌ Don't: Use very short baseDelay (<50ms) for high-volume applications ❌ Don't: Disable adaptiveMode unless debugging specific issues ❌ Don't: Set failureThreshold to 1 (too sensitive to transient errors)
✅ Do: Test configuration changes under realistic load conditions ✅ Do: Monitor retry patterns and adjust based on observed behavior ✅ Do: Consider your downstream service's characteristics when tuning ✅ Do: Use different configurations for different operation types if needed
import software.amazon.awssdk.core.retry.RetryPolicy;
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import java.time.Duration;
public class AdaptiveRetryConfiguration {
public static DynamoDbClient createOptimizedClient() {
AdaptiveRetryStrategy retryStrategy = AdaptiveRetryStrategy.builder()
.maxAttempts(5)
.baseDelay(Duration.ofMillis(100))
.maxBackoffTime(Duration.ofSeconds(20))
.adaptiveMode(true)
.throttlingDetection(true)
.adaptiveRateLimit(false)
.successThreshold(5)
.failureThreshold(3)
.build();
RetryPolicy retryPolicy = RetryPolicy.builder()
.retryStrategy(retryStrategy)
.build();
return DynamoDbClient.builder()
.overrideConfiguration(ClientOverrideConfiguration.builder()
.retryPolicy(retryPolicy)
.build())
.build();
}
}
maxAttempts or maxBackoffTimebaseDelay for time-sensitive operationsadaptiveRateLimit is unnecessarily constraining throughputmaxAttempts within reasonable timeout boundsthrottlingDetection is enabledsuccessThreshold for more stable adaptationmaxAttempts to prevent retry stormsbaseDelay to give services more recovery timeadaptiveRateLimit for high-volume applicationsThis configuration reference provides the foundation for optimizing AdaptiveRetryStrategy behavior based on your specific application requirements and service characteristics.
AWS SDK for Java 2.x Developer Guide - Retry Configuration
https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/retry.html
AWS SDK for Java 2.x API Reference - AdaptiveRetryStrategy
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/retry/RetryStrategy.html
DynamoDB Developer Guide - Error Retries and Exponential Backoff
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff
AWS SDK for Java 2.x API Reference - RetryPolicy
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/retry/RetryPolicy.html
Amazon DynamoDB Best Practices
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html
AWS Architecture Center - Reliability Pillar
https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/welcome.html
Implementing Microservices on AWS - Retry Logic
https://docs.aws.amazon.com/whitepapers/latest/microservices-on-aws/retry-logic.html
AWS Developer Blog - Exponential Backoff and Jitter
https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
AWS SDK for Java 2.x Migration Guide
https://docs.aws.amazon.com/sdk-for-java/latest/migration-guide/
"The Tail at Scale" - Dean & Barroso (2013)
Communications of the ACM, Vol. 56 No. 2, Pages 74-80
https://cacm.acm.org/magazines/2013/2/160173-the-tail-at-scale/fulltext
"Adaptive Timeout and Retry for Resilient Distributed Systems"
IEEE Transactions on Dependable and Secure Computing
Amazon CloudWatch Metrics for DynamoDB
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/monitoring-cloudwatch.html
AWS X-Ray Developer Guide - Tracing AWS SDK Calls
https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java-awssdkclients.html
AWS SDK for Java GitHub Repository
https://github.com/aws/aws-sdk-java-v2
AWS Developer Forums - Java SDK
https://forums.aws.amazon.com/forum.jspa?forumID=70
When referencing this configuration guide in your documentation or code comments, please use:
AdaptiveRetryStrategy Configuration Reference.
Internal Documentation. [Current Date].
Based on AWS SDK for Java 2.x Documentation and Best Practices.
This document is based on:
For the most up-to-date API changes and new features, always consult the official AWS SDK for Java 2.x documentation and release notes.