Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Request Hedging Tool#47 implementation #49

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

Dondehip
Copy link

Issue #47

Description:

This PR provides an DynamoDB request hedging functionality for AWS SDK for Java 2.x.

Key features:

  • Implementation of request hedging in 2 favors, AwsCrtAsyncHttpClient and Netty.
  • Supports request hedging with configurable delays
  • configurable to send upto 5 staggered requests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Dondehip and others added 25 commits December 17, 2024 17:45
- Add ddb.hedging.number config to control concurrent requests
- Create MultiHedgingRequestHandler for parallel request handling
- Integrate hedging support in request pipeline
- Added support for Netty Http client
- MultiHedgingRequestHandler changes to use Netty eventloop.
Implemented the hedging demo using Java SDK 2.0
@tebanieo tebanieo self-requested a review January 31, 2025 14:12
Copy link
Contributor

@tebanieo tebanieo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had very high level comments, I will add one of my colleagues to review this PR, In general I do think we need more documentation overall for the code. Specially since this will be used as a reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include one section that explains how does the sample table looks like and how you run the test as specified in ddb-hedging/src/test/java/com/dynamodbdemo/GenerateLoadTestData.java

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a readme that explains how to use this yml file. It would be nice to include a sample execution in either video or gif.


private static final Logger logger = LoggerFactory.getLogger(DynamoDbConfig.class);

@Value("${aws.dynamodb.region}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you add a validation?

@PostConstruct
public void validateConfiguration() {
    Assert.isTrue(connectionTimeoutSeconds > 0, "Connection timeout must be positive");
    Assert.isTrue(apiTimeoutSeconds > 0, "API timeout must be positive");
    Assert.isTrue(maxConcurrency > 0, "Max concurrency must be positive");
    Assert.hasText(region, "Region must not be empty");
}

@Bean(name = "DDBAsyncClient")
@ConditionalOnProperty(name = "aws.dynamodb.use-crt-client", havingValue = "false")
public DynamoDbAsyncClient getNettyDynamoDbAsyncClient(SdkEventLoopGroup eventLoopGroup) {
if (dynamoDbAsyncClient == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a double-check but can you use the synchronized (xxx.class) {} for extra thread safety? (there was another place, I believe at the logs as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants