Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Let's look how to implement it with Quarkus. In the AWS SAM Template (template.yaml) we point the AWS Lambda function handler to the generic QuarkusStreamHandler implementation:
If we compare these metrics with AWS Lambda with plain Java (and AWS SDK for Java version 2) and Micronaut Framework with SnapStart enbled we'll notice that using the Micronaut Framework the average cold start with Quarkus is quite comparable with the first and better than the latter. If we compile our application with GraalVM Native Image and deploy our Lambda as Custom Runtime (which is beyond the scope if this article), we can further reduce the cold start to between 450 and 550ms, see the measurements for the comparable application.
In the next part of series we'll explore Spring Boot for writing Lambda functions and measure the cold start with and without enabling of the SnapSart.
Quarkus Framework is Kubernetes Native Java stack (personally I don't understand this term :)) tailored for OpenJDK HotSpot and GraalVM, crafted from the best of breed Java libraries and standards. For us it's important that this framework is very well suited for writing Serverless applications. Like Micronaut, it gives us the possibility to create our application using the launcher or CLI, provides API Gateway integration, GraalVM (Native Image) integation, supports Maven und Gradle and much more. It also supports MicroProfile and Funqy for multi cloud solutions. It also processes annotations at compile time and doesn't use reflection, runtime byte code generation, runtime generated proxies and dynamic class loading.
Related posts
- Is it okay to use com.sun.net.httpserver.HttpServer?
- why does java require tomcat?
- Quarkus 2.0 Delivers Continuous Testing, CLI and Supports Minimal JDK 11
- 🏅 Http4k: Top 5 Server-Side Frameworks for Kotlin in 2022
- 2023 will be when browsers will support GC-based languages in production. Both GC and Exception Handling are already available to various degrees. Being an early adopter could boost Scala's adoption by being one of the first but also the best language in the browser!