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.
- AWS CLI
- AWS SAM
- Java 11
- Maven
- Artillery for load-testing the application
- Docker (at least 8GB memory and 4 CPUs)
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.
The sample application can be deployed in three different ways:
- Managed Java Runtime (without SnapStart) - This mode uses zip packaging style and runs on the JVM inside the Lambda environment.
- Managed Java Runtime (with SnapStart) - This mode enables SnapStart on the Lambda functions. Current examples only include Spring boot version of the application. Stay tuned for other framework examples with SnapStart. Learn more about SnapStart here.
- 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.
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.
Cold Start (ms) | Warm Start (ms) | |||||||
---|---|---|---|---|---|---|---|---|
p50 | p90 | p99 | max | p50 | p90 | p99 | max | |
Micronaut | 4898.8332 | 5479.1013 | 7551.7604 | 10147.71 | 9.3759 | 17.1385 | 42.356 | 531.75 |
Quarkus | 3808.0718 | 4229.4438 | 5501.0506 | 7195.38 | 8.6605 | 15.3362 | 38.5082 | 375.65 |
Spring Boot | 5517.570 | 6442.1359 | 8616.8082 | 11551.01 | 9.3759 | 16.8686 | 40.3863 | 319.69 |
Dagger * | 3213.0091 | 3629.6889 | 4850.1132 | 6896.54 | 8.9399 | 16.3415 | 40.3863 | 292.2 |
Cold Start (ms) | Warm Start (ms) | |||||||
---|---|---|---|---|---|---|---|---|
p50 | p90 | p99 | max | p50 | p90 | p99 | max | |
Spring Boot | 767.15 | 868.37 | 978.05 | 1271.93 | 8.07 | 13.65 | 28.41 | 226.37 |
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 |
You can find implementations of this project in other languages here:
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.