Closed
Description
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 to META-INF
to make it Native compatible
Describe alternatives you've considered
N/A
Additional context
N/A
Metadata
Metadata
Assignees
Type
Projects
Status
Coming soon
Activity
msailes commentedon Feb 21, 2022
Hi @driverpt
Can you let us know what errors you're seeing?
Thanks,
Mark
madeupname commentedon Sep 8, 2022
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
gradle test
, it works fine:{"timestamp":"2022-09-08T00:15:48.010-0700PDT","instant":{"epochSecond":1662621348,"nanoOfSecond":10314100},"thread":"Test worker","level":"INFO","loggerName":"helloworld.App","message":"Entered handleRequest.","endOfBatch":false,"loggerFqcn":"org.apache.logging.log4j.spi.AbstractLogger","threadId":1,"threadPriority":5,"samplingRate":"0.0"}
But local invoke or deployed to AWS, it fails:
msailes commentedon Sep 8, 2022
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.
madeupname commentedon Sep 8, 2022
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:
madeupname/samkgg@b404f55
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.
madeupname commentedon Sep 16, 2022
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
jeromevdl commentedon Nov 16, 2022
@madeupname I'm currently working on it (#965). But will probably be in a v2 as it comes with breaking changes.
miracle-the-V commentedon Apr 27, 2023
Backing this. Native image assembly currently fails with
Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.osgi.framework.FrameworkUtil. This error is reported at image build time because class org.apache.logging.log4j.core.config.plugins.util.ResolverUtil is registered for linking at image build time by command line
Lambdas written in Java don't stand a chance without GraalVM native image when it comes to performance, so this is, unfortunately, a deal-breaker atm.
msailes commentedon Apr 27, 2023
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?
35 remaining items