-
Notifications
You must be signed in to change notification settings - Fork 88
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
GraalVM Support #764
Comments
Hi @driverpt Can you let us know what errors you're seeing? Thanks, Mark |
I'm not the OP, but I'm also struggling with this. Do you have an example that shows this working on GraalVM? Because just for log4j2, it does appear you need to add quite a bit to resource-config.json and reflect-config.json to get it to run without crashing. I'm working on an example project specifically to showcase GraalVM/Lambda and my first step is to add logging. You can see the code here: https://github.com/madeupname/samkgg/tree/3-add-logging I've followed a couple examples of getting log4j2 and GraalVM working and it doesn't crash anymore, but still has errors around Log4j. The method does run, but no logging. I'll add that if you run
But local invoke or deployed to AWS, it fails:
|
We have someone looking at GraalVM support atm, could you include the config you have so far. I think this is more likely a Log4J issue, but we'll add their config to our project in the meantime. |
That's great to hear, excited to see a working example. My project is directly based on the official SAM GraalVM template. By config, I assume you mean what I have in resource-config.json and reflect-config.json to get it running. The project I linked is very small, but you can all changes I made for Powertools in this commit: As in the commit message, some things that might help you:
You can see from link above that GraalVM officially supports java.util.logging, but it does appear people have gotten log4j2 to work. Looks like considerably more effort, though. |
After further investigation, I'm giving up on Powertools in GraalVM. It looks great, but is coupled to Log4j 2 and they have said it does not and will not support GraalVM (maybe in Log4j 3): https://issues.apache.org/jira/browse/LOG4J2-2604 If you switch to a Graal-safe logging framework, I'm happy to try again. I ended up using SLF4J and JUL. GraalVM and Lambda is surprisingly tricky for logging and I've documented my findings here: https://philip.yurchuk.com/software/samkgg-lessons-learned/#logging |
@madeupname I'm currently working on it (#965). But will probably be in a v2 as it comes with breaking changes. |
Backing this. Native image assembly currently fails with |
Hi @miraclefoxx, This is a Log4J class which is causing the problem. We are considering changing our logging approach in the next major version. Until then have you considered using Lambda SnapStart? |
We are already using graal, and it is significantly better than snapstart. It simply can not compete with a flat 5-10x increase in speed (compared to snapstart, can be 20x without it), and you can actually benchmark it properly as it is consistent. (the jvm slowly tries to speed up with each execution, but in this environment it just can't) |
Thanks @Frontrider for the feedback. May I ask if you have a running example of a Java / GraalVM Lambda working with powertools (logging) that you could share or if you want to write one for our examples? |
I'll take a look into the GraalVM Support and can add a working example - probably next month. |
I'll note that I ended up not using this. The actual lambda I was developing long term was in kotlin, and the tools for that language generally don't have issues on graalvm. |
No problem @Frontrider, maybe we can do something for the others. Also note that Powertools works with Kotlin (example) |
@maschnetwork, ideally would be great to have a sample that leverages most of the modules: |
Could we extend an existing example rather than adding more? Cognizant we have a lot of code in the examples to maintain as it is. I think the brunt of the work here is validating what does and doesn't work with Graal, and then actioning that. I wonder if we could be clever about this and "aspect" the E2E test so that we run one variant with the demo function compiled with Graal? We already have good automated coverage of the utilities there. |
My objective was more to make sure all our modules work on GraalVM. But once we are sure, we can probably just have the core one provided in the examples |
@rr-on-gh and myself are looking into it at the moment - will provide an update soon |
Any update on when this is planned? I am facing issues with powertools metrics as well when using quarkus graalvm native image. It's falling back to "unknown" emf environment and trying to connect to Agent Endpoint from Lambda. Overriding the AWS_EMF_ENVIRONMENT to "Lambda" is not reflected while running the function. For powertools logging it's failing while initializing the classes at build time,as log4j is not supported by GraalVM |
@vignesh-manel I have been able to spend some time on the the PT logging part. The version |
Is your feature request related to a problem? Please describe.
We want to make Lambdas faster by turning them into native code.
Describe the solution you'd like
Add
reflect.json
or similar toMETA-INF
to make it Native compatibleDescribe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: