aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.17k stars 840 forks source link

CRT Http Client doesn't support GraalVM #2948

Closed msailes closed 3 months ago

msailes commented 2 years ago

Describe the bug

@zoewangg added GraalVM support to the v2 SDK in https://github.com/aws/aws-sdk-java-v2/pull/2268. However when I build a native-image project with the CRT Http Client I get a number of errors to do with missing resources, classes, functions.

Could GraalVM support be added to this module as well?

Expected behavior

When I compile my application with GraalVM native-image modules from the AWS SDK for Java v2 should work without any further configuration.

Current behavior

Stack traces for missing resources, classes and functions.

Steps to Reproduce

https://github.com/aws-samples/serverless-graalvm-demo/tree/low-latency

Possible Solution

I'm part way through the required configuration, but I don't understand the CRT project well enough to complete it.

https://github.com/aws-samples/serverless-graalvm-demo/tree/low-latency/software/products/src/main/resources/META-INF/native-image/software.amazon.awssdk/aws-crt-client

Context

The CRT client is the fastest Http Client available within the AWS SDK for Java. I would like to use this within applications I compile with GraalVM native-image.

AWS Java SDK version used

2.17.100-PREVIEW

JDK version used

OpenJDK Runtime Environment GraalVM CE 21.3.0

Operating System and version

AL2 on Lambda

debora-ito commented 2 years ago

Hi @msailes 👋 thank you for submitting this issue.

We'll add this to our backlog. I'm changing this to a feature request though, the CRT Client is still in dev preview and was not in the initial plans when the native image was released.

timmattison commented 2 years ago

Most of the functions I've written with native image do their job in a few milliseconds but hitting a single API adds hundreds of milliseconds to the duration (not just initialization). Making CRT just work with native image would significantly reduce the cost of native image Lambdas.

maschnetwork commented 2 years ago

Thanks to @timmattison initial PR here I was able to get the CRT client now running with GraalVM. I described the full process to get the configs on the PR and you can find a full working version writing records to DynamoDB in this repo: https://github.com/maschnetwork/aws-lambda-graalvm-crt

@zoewangg it would be very cool to get this supported out of the box and the mentioned PR is a good starting point.

msailes commented 10 months ago

@debora-ito the CRT Client is now GA, can this be revisited

antechrestos commented 10 months ago

@debora-ito @yasminetalby do we know if/when it would be available? @maschnetwork did a great on his project and it would be great that thre project take the responsability of it

MatejNedic commented 9 months ago

Hey @msailes , any idea when we can see this resolved? Is there any way we can help? Looking forward to this so I can test spring-cloud-aws S3 integration with it!

maschnetwork commented 9 months ago

Hi @MatejNedic @antechrestos , I'll open a PR for this in early January on this repo https://github.com/awslabs/aws-crt-java - Will post the reference here and keep you posted.

scrocquesel commented 8 months ago

@maschnetwork Do you know if there are plans to support --link-at-build-time ? Somes places check for the presence of an eventually present CRT class and this is not supported by GraalVM with this argument.

maschnetwork commented 7 months ago

@scrocquesel I would need to take a deeper look into this one. Lets track it as an issue once the first version is merged.

zoewangg commented 3 months ago

CRT GraalVM support is added in https://github.com/awslabs/aws-crt-java/pull/791 and released in 0.29.20. Resolving.

PR to bump CRT version in the SDK: https://github.com/aws/aws-sdk-java-v2/pull/5290

github-actions[bot] commented 3 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.