aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

CRT Http Client doesn't support GraalVM

Open msailes opened this issue 3 years ago • 9 comments

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

msailes avatar Jan 04 '22 11:01 msailes

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.

debora-ito avatar Jan 26 '22 22:01 debora-ito

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.

timmattison avatar Jan 28 '22 18:01 timmattison

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.

maschnetwork avatar Jun 21 '22 08:06 maschnetwork

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

msailes avatar Nov 13 '23 12:11 msailes

@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

antechrestos avatar Dec 06 '23 09:12 antechrestos

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!

MatejNedic avatar Dec 23 '23 09:12 MatejNedic

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.

maschnetwork avatar Dec 26 '23 10:12 maschnetwork

@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.

scrocquesel avatar Jan 30 '24 23:01 scrocquesel

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

maschnetwork avatar Feb 10 '24 15:02 maschnetwork