GoodforGod / awslambda-java-examples

πŸ§ͺ AWS Lambda Java GraalVM examples & Benchmark.

Home Page:http://goodforgod.dev/awslambda-java-examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWSLambda Java Examples

Minimum required Java version GitHub Action

Repository with AWSLambda examples for different frameworks Java Frameworks compiled for GraalVM such:

Benchmark

Benchmark tries to compare different Java frameworks that can be used to build AWS Lambda Function. Benchmark compares cold start time, hot start time, building process, etc.

GraalVM Versions

All examples use GraalVM 22.3.0 cause at that time Spring & Quarkus latest available GraalVM build image was GraalVM 22.3.0. Those frameworks are limited by their plugins/buildpacks/etc, so you can't use latest available GraalVM native image released, all depends on framework toolkit which upgrades with lag.

Thus, Micronaut & SimpleLambda have advantage as GraalVM building process & Jar building process can be easily independent.

Framework Versions

Spring Boot Spring Cloud Micronaut Quarkus SimpleLambda
3.1.3 4.0.5 4.0.3 3.3.0 1.0.0

Cold Start

Test data is collected based on 5 runs and average for each value is present in table below:

Framework Spring Quarkus Micronaut (Application) Micronaut (Function) SimpleLambda + Micronaut SimpleLambda
Build (ms) 527.4 349.0 442.8 398.8 278.5 237.1
Duration (ms) 212.1 236.5 110.9 63.2 18.3 31.8
Billed (ms) 739.8 586.0 554.2 462.4 297.2 282.6
Memory (Mb) 115 76 89 83 60 52

Hot Start

Test data is collected based on 5 runs and average for each value is present in table below:

Framework Spring Quarkus Micronaut (Application) Micronaut (Function) SimpleLambda + Micronaut SimpleLambda
Duration (ms) 2.9 1.2 1.9 1.8 1.4 1.4
Billed (ms) 3.2 2.0 2.2 2.0 2.0 2.0
Memory (Mb) 115 76 90 84 61 53

Hot start billed time is same across all competitors cause when function is instantiated it performs relatively fast.

Build Time

Data is based on build benchmark in GitHub CI action:

Framework Spring Quarkus Micronaut (Application) Micronaut (Function) SimpleLambda + Micronaut SimpleLambda
Build Time (sec) 500 427 298 293 185 200

Build Size

Result function zip archive size in Mb:

Framework Spring Quarkus Micronaut (Application) Micronaut (Function) SimpleLambda + Micronaut SimpleLambda
Size (Mb) 23.9 14.7 16.9 15.7 11.2 9.86

Functionality

Table with some useful and interesting functionality that some frameworks provides, so it won't look that some frameworks are bad and others are great.

Framework Spring Quarkus Micronaut (Application) Micronaut (Function) SimpleLambda + Micronaut SimpleLambda
DI & IoC βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ ❌
AWS Gateway Support ❌ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ βœ”οΈ
AWS Gateway Routing πŸ”· πŸ”· βœ”οΈ ❌ ❌ ❌
AWS Integrations βœ”οΈ βœ”οΈ βœ”οΈ ❌ βœ”οΈ ❌
GraalVM Metadata Auto Auto Auto/Manual Auto/Manual Auto/Manual Auto/Manual

About

πŸ§ͺ AWS Lambda Java GraalVM examples & Benchmark.

http://goodforgod.dev/awslambda-java-examples/

License:Apache License 2.0


Languages

Language:Java 86.8%Language:Dockerfile 6.7%Language:Shell 6.5%