Skip to content

Conversation

tebanieo
Copy link

#7554

Add AdaptiveRetryStrategy Examples for DynamoDB Java SDK v2

This PR adds comprehensive examples and documentation for implementing AdaptiveRetryStrategy with Amazon DynamoDB using AWS SDK for Java 2.x. These examples demonstrate how to migrate from StandardRetryStrategy to AdaptiveRetryStrategy for improved retry behavior and performance.

What's New

New Examples:

  • BasicAdaptiveRetryImplementation.java - Basic setup and configuration patterns
  • MigrationExamples.java - Before/after migration examples with detailed comparisons

Documentation:

  • Comprehensive documentation in adaptive_retry_docs/ directory
  • Migration guide with step-by-step instructions
  • Configuration reference with best practices
  • Conceptual overview of when and why to use AdaptiveRetryStrategy

Problem Solved

  • Provides concrete examples for developers wanting to implement adaptive retry strategies
  • Addresses the gap in documentation for migrating from default retry approaches
  • Demonstrates AWS SDK v2 best practices for retry configuration

Key Features

Adaptive Retry Benefits:

  • Client-side rate limiting to prevent retry storms
  • Intelligent throttling detection with separate backoff strategies
  • Built-in circuit breaking for failure protection
  • Adaptive learning from retry patterns

Migration Examples:

  • Basic standard-to-adaptive migration
  • Custom backoff configuration
  • High-throughput application optimization
  • Batch operation retry strategies

Files Added/Modified

New Files:

javav2/example_code/dynamodb/src/main/java/com/example/dynamodb/ 
├── BasicAdaptiveRetryImplementation.java 
├── MigrationExamples.java 
└── README_ADAPTIVE_RETRY.md

javav2/example_code/dynamodb/adaptive_retry_docs/ 
├── README.md 
├── concepts.md 
├── migration-guide.md 
└── configuration-reference.md

Modified Files:

  • javav2/example_code/dynamodb/README.md - Added links to new retry strategy examples
  • javav2/example_code/dynamodb/src/test/java/DynamoDBTest.java - Added test coverage

Usage Examples

// Basic AdaptiveRetryStrategy setup
DynamoDbClient client = DynamoDbClient.builder()
    .region(Region.US_EAST_1)
    .overrideConfiguration(ClientOverrideConfiguration.builder()
        .retryStrategy(AdaptiveRetryStrategy.builder()
            .maxAttempts(3)
            .backoffStrategy(BackoffStrategy.exponentialDelay(
                Duration.ofMillis(100), Duration.ofSeconds(20)))
            .throttlingBackoffStrategy(BackoffStrategy.exponentialDelay(
                Duration.ofSeconds(1), Duration.ofSeconds(20)))
            .build())
        .build())
    .build();

Related Documentation


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the Java-v2 This issue relates to the AWS SDK for Java V2 label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java-v2 This issue relates to the AWS SDK for Java V2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants