Skip to content

Integrating AWS CRT 0.5.1 into aws-crt-dev-preview #1769

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
18c17b9
Updated crt http client to use latest crt api, which uses byte[] for …
JonathanHenson Nov 4, 2019
f39e59e
Removed old comment.
JonathanHenson Nov 4, 2019
037f03d
Fixed build failures.
JonathanHenson Nov 5, 2019
37ceb55
Fixed benchmark builds.
JonathanHenson Nov 5, 2019
c53e121
Removed unused import.
JonathanHenson Nov 5, 2019
20a907e
Fixed SPI test.
JonathanHenson Nov 5, 2019
d2466d5
Hopefully fix the build this time.
JonathanHenson Nov 5, 2019
a03e35a
Updating SDK to work with most recent CRT
rccarper Jan 10, 2020
37fe7c5
Taking out incorrect try-with-resources block
rccarper Jan 27, 2020
9125cb8
Updating to latest SDK snapshot and CRT
rccarper Jan 28, 2020
20728ff
Adjusting usage of builder, removing whitespace change.
rccarper Jan 29, 2020
6295b73
Updating snapshot version
rccarper Mar 1, 2020
e9ecbbe
Updating copyright headers
rccarper Mar 1, 2020
9df0bb6
Fixing checkstyle warning for 'TLS' being more than 2 consecutive cap…
rccarper Mar 1, 2020
f830694
Updating snapshot and CRT version
rccarper Mar 24, 2020
907a82a
Grabbing commit 025c43c52d4bf92ae36959e8b8a473589ba3345a: Update AWS …
alexw91 Mar 31, 2020
9a59ada
Updating snapshot version and adding aws-crt-client to tests coverage…
rccarper Apr 1, 2020
5be5b16
Fixing copyright headers. Fixing CRT version in sdk-benchmarks.
rccarper Apr 2, 2020
92c24d1
Adding manual window management flag
rccarper Apr 2, 2020
9b3ddc4
Fixing version in pom file
rccarper Apr 3, 2020
45ceea3
Updating pom version
rccarper Apr 6, 2020
ea67a61
Updating comment
rccarper Apr 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion http-clients/aws-crt-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<version>0.3.35</version>
<version>0.5.1</version>
</dependency>

<!--SDK dependencies-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,8 @@
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
import software.amazon.awssdk.crt.CrtResource;
import software.amazon.awssdk.crt.io.EventLoopGroup;
import software.amazon.awssdk.crt.io.HostResolver;
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.regions.Region;
Expand Down Expand Up @@ -95,8 +97,12 @@ private boolean testWithClient(KmsAsyncClient asyncKMSClient, int numberOfReques
}

private boolean testWithNewClient(int eventLoopSize, int numberOfRequests) {
try (SdkAsyncHttpClient newAwsCrtHttpClient = AwsCrtAsyncHttpClient.builder()
.eventLoopSize(eventLoopSize)

try (EventLoopGroup eventLoopGroup = new EventLoopGroup(eventLoopSize);
HostResolver hostResolver = new HostResolver(eventLoopGroup);
SdkAsyncHttpClient newAwsCrtHttpClient = AwsCrtAsyncHttpClient.builder()
.eventLoopGroup(eventLoopGroup)
.hostResolver(hostResolver)
.build()) {
try (KmsAsyncClient newAsyncKMSClient = KmsAsyncClient.builder()
.region(REGION)
Expand Down Expand Up @@ -156,9 +162,12 @@ public void checkAllCombinations(@FromDataPoints("EventLoop") int eventLoopSize,
.put(SdkHttpConfigurationOption.MAX_CONNECTIONS, connectionPoolSize)
.build();

EventLoopGroup eventLoopGroup = new EventLoopGroup(eventLoopSize);
HostResolver hostResolver = new HostResolver(eventLoopGroup);

SdkAsyncHttpClient awsCrtHttpClient = AwsCrtAsyncHttpClient.builder()
.eventLoopSize(eventLoopSize)
.eventLoopGroup(eventLoopGroup)
.hostResolver(hostResolver)
.buildWithDefaults(attributes);

KmsAsyncClient sharedAsyncKMSClient = KmsAsyncClient.builder()
Expand Down Expand Up @@ -194,6 +203,9 @@ public void checkAllCombinations(@FromDataPoints("EventLoop") int eventLoopSize,
awsCrtHttpClient.close();
Assert.assertFalse(failed.get());

hostResolver.close();
eventLoopGroup.close();

CrtResource.waitForNoResources();

float numSeconds = (float) ((System.currentTimeMillis() - start) / 1000.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.junit.Test;
import software.amazon.awssdk.core.SdkBytes;
import software.amazon.awssdk.crt.CrtResource;
import software.amazon.awssdk.crt.io.EventLoopGroup;
import software.amazon.awssdk.crt.io.HostResolver;
import software.amazon.awssdk.crt.io.TlsCipherPreference;
import software.amazon.awssdk.crt.io.TlsContextOptions;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
Expand All @@ -32,6 +34,8 @@ public class AwsCrtClientKmsIntegrationTest {
private static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
private static Region REGION = Region.US_EAST_1;
private static List<SdkAsyncHttpClient> awsCrtHttpClients = new ArrayList<>();
private static EventLoopGroup eventLoopGroup;
private static HostResolver hostResolver;

@Before
public void setup() {
Expand All @@ -43,9 +47,13 @@ public void setup() {
continue;
}

int numThreads = 1;
eventLoopGroup = new EventLoopGroup(numThreads);
Copy link
Contributor

Choose a reason for hiding this comment

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

I"m not sure what the purposes of these changes is. Care to enlighten me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The client doesn't create its own event loop group anymore, as people felt it was a bit awkward for them to create such a heavy object. Because of that, we don't have the .eventLoopSize(1) builder change that we used to have on the client, and this is meant to be the replacement of that. (The numThreads variable is just meant to be more explicit about what's being passed in, and could arguably be taken out or made final.)

hostResolver = new HostResolver(eventLoopGroup);

SdkAsyncHttpClient awsCrtHttpClient = AwsCrtAsyncHttpClient.builder()
.eventLoopSize(1)
.eventLoopGroup(eventLoopGroup)
.hostResolver(hostResolver)
.build();

awsCrtHttpClients.add(awsCrtHttpClient);
Expand All @@ -55,6 +63,8 @@ public void setup() {

@After
public void tearDown() {
hostResolver.close();
eventLoopGroup.close();
CrtResource.waitForNoResources();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,8 @@
import software.amazon.awssdk.core.ResponseBytes;
import software.amazon.awssdk.core.async.AsyncResponseTransformer;
import software.amazon.awssdk.crt.CrtResource;
import software.amazon.awssdk.crt.io.EventLoopGroup;
import software.amazon.awssdk.crt.io.HostResolver;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3AsyncClient;
Expand All @@ -50,6 +52,8 @@ public class AwsCrtClientS3IntegrationTest {

private static Region REGION = Region.US_EAST_1;

private static EventLoopGroup eventLoopGroup;
private static HostResolver hostResolver;
private static SdkAsyncHttpClient crtClient;

private static S3AsyncClient s3;
Expand All @@ -58,8 +62,13 @@ public class AwsCrtClientS3IntegrationTest {
public void setup() {
CrtResource.waitForNoResources();

int numThreads = 4;
eventLoopGroup = new EventLoopGroup(numThreads);
hostResolver = new HostResolver(eventLoopGroup);

crtClient = AwsCrtAsyncHttpClient.builder()
.eventLoopSize(4)
.eventLoopGroup(eventLoopGroup)
.hostResolver(hostResolver)
.build();

s3 = S3AsyncClient.builder()
Expand All @@ -73,7 +82,8 @@ public void setup() {
public void tearDown() {
s3.close();
crtClient.close();

hostResolver.close();
eventLoopGroup.close();
CrtResource.waitForNoResources();
}

Expand Down Expand Up @@ -108,4 +118,4 @@ public void testParallelDownloadFromS3() throws Exception {
}
}

}
}
Loading