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.
We'll use the same application as in the first part of this series, but we'll rewrite it to use Micronaut Framework. The code of this sample application can be found here. It basically provides AWS API Gateway and 2 Lambda functions: "CreateProduct" and "GetProductById". The products are stored in the Amazon DynamoDB. We'll use AWS Serverless Application Model (AWS SAM) for the infrastructure as a code.
Conclusions and next steps In this blog post we looked into the Micronaut Framework and learned how to write AWS Lambda function which receives the event from AWS API Gateway. We also measured the cold start with and without enabling of the SnapStart. Especially in case of enabling SnapStart the cold starts were only slightly higher compared to the Lambda written with the plain Java. As Micronaut Framework increases the productivity of the developers by providing lots of features (see the list above), it's worth considering to use it. In the next part of series we'll explore Quarkus for writing Lambda functions and measure the cold start with and without enabling of the SnapSart.
Micronaut Framework and its features Micronaut Framework is modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications. It gives us the possibility to create our application using the launcher or CLI, provides customer validation, API Gateway integration, GraalVM (Native Image) integation, supports Maven und Gradle and much more. What is very important, is that the Micronaut processes annotations at compile time and doesn't use reflection, runtime byte code generation, runtime generated proxies and dynamic class loading. On the other hand Micronaut doesn't support MicroProfile.