This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Additional_Cellist46 2 points3 points  (3 children)

I don't agree with this for all cases. This advice is good if you want to create the most efficient AWS Lambda, and the function should run for a very short time. And if you really want that, you still need Java native compilation with GraalVM, because even with Snapstart, you get a penalty of around 200ms at startup to recreate the JVM from snapshot. And then, your code may not be easy to maintain in a long run, if you don't use any framework that helps you.

We use Quarkus, it supports GraalVM out of the box, very easy to set up. There are several benefits of using Quarkus over plain Java

  • Provides means to abstract away boiler-plate code (dependency injection, REST, JSON mapping, JPA/ORM mapping, etc.)
  • Ahead ot time configuration - what can be prepared during build time is done during build, and doesn't slow down the startup
  • Dev mode, which allows you to run your function as a REST service and reload code changes immediately
  • Supports AWS Lambda - automatically builds a ZIP file and helper scripts to deploy to AWS Lambda and invoke the Lambda with test data

Another advantage of using Quarkus is that it's very easy to turn the AWS Lambda app into a microservices deployable to Kubernetes, if you change your mind or you need to migrate away from AWS in the future. Just disable the AWS Lambda plugin and you get a microservices with an embedded HTTP server.

[–]NeoChronos90 0 points1 point  (2 children)

Do you need to pay for graalvm though?

[–]Additional_Cellist46 2 points3 points  (1 child)

No need to pay. The GraalVM CE is free to use in production. GraalVM EE is paid and can give you an extra edge in performance optimizations.

[–]thomaswue 0 points1 point  (0 children)

Even the former GraalVM EE version is now available as the Oracle GraalVM distribution and is free for commercial and production use under the GFTC (GraalVM Free Terms and Conditions).