kidmam / serverless-java-frameworks-samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda demo with common Java application frameworks

Architecture diagram

This is a simple serverless application built in Java using popular frameworks - Micronaut, Quarkus, and Spring Boot

It consists of an Amazon API Gateway backed by four AWS Lambda functions and an Amazon DynamoDB table for storage.

Requirements

Software

Each of the sub folders contains a Products maven project. Each maven project contains all the code for all four Lambda functions. It uses the hexagonal architecture pattern to decouple the entry points, from the main domain logic and the storage logic.

Infrastructure

The sample application can be deployed in two different ways:

  1. JVM - This mode uses zip packaging style and runs on the JVM inside the Lambda environment.
  2. Custom Runtime - This mode uses GraalVM native image and uses Custom Runtime to run on Lambda. GraalVM native image is a stand-alone execution binary and does not require a JVM to run.

Deployment and Testing

Micronaut

Quarkus

Spring Boot

Summary

Below is the cold start and warm start latencies observed. Please refer to "Load Test" section of each sub-project for more details. All latencies listed below are in milliseconds.

Artillery is used to make 100 requests / second for 10 minutes to our API endpoints.

Results from Managed Java Runtime

Cold Start (ms) Warm Start (ms)
p50 p90 p99 max p50 p90 p99 max
Micronaut 8505.57 8977.26 9685.76 10512.48 9.38 14.86 40.39 553.75
Quarkus 6384.45 6671.49 7055.55 8303.17 10.41 19.07 48.45 317.69
Spring Boot 12673.61 13098.60 13497.31 14118.06 10.99 21.75 75.00 419.90

Results from GraalVM Native images running in custom runtime

Cold Start (ms) Warm Start (ms)
p50 p90 p99 max p50 p90 p99 max
Micronaut 604.16 659.02 700.45 893.70 6.30 8.00 15.88 69.9
Quarkus 437.45 475.76 519.50 528.03 7.45 12.60 21.32 93.45
Spring Boot 620.66 684.53 721.77 751.98 9.10 14.22 23.61 259.16

πŸ‘€ With other languages

You can find implementations of this project in other languages here:

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

License:MIT No Attribution


Languages

Language:Java 89.7%Language:JavaScript 6.8%Language:Shell 3.5%