diff --git a/README.md b/README.md index ece9daa..16f3b9a 100644 --- a/README.md +++ b/README.md @@ -85,26 +85,26 @@ All latencies listed below are in milliseconds. 314.99 - Quarkus (Java 17) - 2525.22 - 3146.27 - 4055.57 - 6343.83 - 7.50 - 12.28 - 29.87 - 231.52 + Quarkus (Java 21) + 2807.45 + 3330.47 + 4051.52 + 4483.37 + 8.07 + 12.91 + 24.61 + 156.30 - Spring Boot (Java 17) - 5311.93 - 5645.88 - 6183.47 - 7027.66 - 8.13 - 13.01 - 30.03 - 251.27 + Spring Boot (Java 21) + 5731.16 + 6018.84 + 6258.09 + 7011.35 + 8.32 + 13.54 + 26.65 + 174.24 Dagger * @@ -153,26 +153,26 @@ It fits particularly well with Lambda to reduce the initialization time, but doe 244.82 - Quarkus (Java 17) - 487.31 - 586.87 - 732.67 - 932.17 - 7.38 - 11.91 - 25.20 - 147.26 + Quarkus (Java 21) + 680.44 + 812.12 + 922.04 + 1038.75 + 7.75 + 13.11 + 23.84 + 174.29 - Spring Boot (Java 17) - 1047.87 - 1200.45 - 1597.68 - 1779.53 - 7.62 - 13.01 - 27.73 - 262.25 + Spring Boot (Java 21) + 1085.19 + 1278.47 + 1583.38 + 1967.14 + 7.10 + 12.01 + 23.09 + 207.14 @@ -208,26 +208,26 @@ It fits particularly well with Lambda to reduce the initialization time, but doe 1029.55 - Quarkus (22.3.r17) - 467.27 - 599.77 - 802.43 - 1348.78 - 6.7 - 11.63 - 24.03 - 168.47 + Quarkus + 459.40 + 507.19 + 539.07 + 583.33 + 7.04 + 11.82 + 19.38 + 228.46 Spring Boot - 620.66 - 684.53 - 721.77 - 751.98 - 9.10 - 14.22 - 23.61 - 259.16 + 732.67 + 835.17 + 918.36 + 1083.40 + 8.53 + 13.54 + 22.01 + 156.96 diff --git a/quarkus/load-test/run-load-test-native.sh b/quarkus/load-test/run-load-test-native.sh index 5aa795a..b1274a8 100755 --- a/quarkus/load-test/run-load-test-native.sh +++ b/quarkus/load-test/run-load-test-native.sh @@ -1,4 +1,4 @@ -STACK_NAME=quarkus-native-sample +STACK_NAME=quarkus-native API_URL=$(aws cloudformation describe-stacks --stack-name $STACK_NAME \ --query 'Stacks[0].Outputs[?OutputKey==`ApiEndpoint`].OutputValue' \ diff --git a/quarkus/pom.xml b/quarkus/pom.xml index 8b565ef..85ff0ce 100644 --- a/quarkus/pom.xml +++ b/quarkus/pom.xml @@ -9,18 +9,18 @@ 3.8.1 true - 17 - 17 + 21 + 21 UTF-8 UTF-8 - 3.0.1.Final + 3.6.3 quarkus-bom io.quarkus - 3.0.1.Final + 3.6.3 3.0.0-M5 uber-jar ${project.artifactId}-${project.version}-aws.jar - 2.20.42 + 2.20.42 @@ -138,7 +138,7 @@ native true - quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.3-java17 + quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 --initialize-at-run-time=software.amazon.awssdk.services.dynamodb.DynamoDbRetryPolicy\,org.apache.http.impl.auth.NTLMEngineImpl\,software.amazonaws.example.product.product.dao.DynamoProductDao diff --git a/quarkus/template.native.yaml b/quarkus/template.native.yaml index 663b5d3..ff3bd4e 100644 --- a/quarkus/template.native.yaml +++ b/quarkus/template.native.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/function.zip Handler: not.used.in.provided.runtime - Runtime: provided + Runtime: provided.al2023 Timeout: 30 MemorySize: 1024 Environment: diff --git a/quarkus/template.snapstart.yaml b/quarkus/template.snapstart.yaml index 79a9807..af86f1c 100644 --- a/quarkus/template.snapstart.yaml +++ b/quarkus/template.snapstart.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/quarkus-lambda-function-1.0.0-SNAPSHOT-aws.jar Handler: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest - Runtime: java17 + Runtime: java21 Timeout: 30 MemorySize: 1024 AutoPublishAlias: live diff --git a/quarkus/template.yaml b/quarkus/template.yaml index 8c104ee..5da32ec 100644 --- a/quarkus/template.yaml +++ b/quarkus/template.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/quarkus-lambda-function-1.0.0-SNAPSHOT-aws.jar Handler: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::handleRequest - Runtime: java17 + Runtime: java21 Timeout: 30 MemorySize: 1024 Environment: diff --git a/springboot/README.md b/springboot/README.md index 5111ca3..cd9ef07 100644 --- a/springboot/README.md +++ b/springboot/README.md @@ -29,17 +29,17 @@ You can learn more about SnapStart and Priming [here](https://aws.amazon.com/blo On macOS: ```bash -docker run -v ~/.m2/repository:/root/.m2/repository --mount type=bind,source=$(pwd),destination=/project -it --entrypoint /bin/bash marksailes/al2-graalvm:11-22.0.0.2 +docker run -v ~/.m2/repository:/root/.m2/repository --mount type=bind,source=$(pwd),destination=/project -it --entrypoint /bin/bash dmahapatro/al2023-graalvm:21-21.0.1 ``` On macOS ARM: ```bash -docker run --mount type=bind,source=$(pwd),destination=/project -it --entrypoint /bin/bash marksailes/arm64-al2-graalvm:17-22.0.0.2 +docker run -v ~/.m2/repository:/root/.m2/repository --mount type=bind,source=$(pwd),destination=/project -it --entrypoint /bin/bash aneelm/al2023-graalvm:aarm64-21-21.0.1 ``` On Windows: ```bash -docker run -v :/project -it --entrypoint /bin/bash marksailes/al2-graalvm:11-22.0.0.2 +docker run -v :/project -it --entrypoint /bin/bash dmahapatro/al2023-graalvm:21-21.0.1 ``` Make sure to replace `SPRING_BOOT_DIR_ABSOLUTE_PATH` with an absolute path to springboot directory. diff --git a/springboot/load-test/run-load-test-native.sh b/springboot/load-test/run-load-test-native.sh index 00c0b09..878809d 100755 --- a/springboot/load-test/run-load-test-native.sh +++ b/springboot/load-test/run-load-test-native.sh @@ -1,4 +1,4 @@ -STACK_NAME=springboot-sample-native +STACK_NAME=springboot-native API_URL=$(aws cloudformation describe-stacks --stack-name $STACK_NAME \ --query 'Stacks[0].Outputs[?OutputKey==`ApiEndpoint`].OutputValue' \ diff --git a/springboot/pom.xml b/springboot/pom.xml index 394d706..56b0b24 100644 --- a/springboot/pom.xml +++ b/springboot/pom.xml @@ -1,12 +1,13 @@ - + 4.0.0 org.springframework.boot spring-boot-starter-parent - 3.0.6 - + 3.2.0 + software.amazonaws.example springboot-lambda-function @@ -15,16 +16,15 @@ Sample project for Spring Boot - 17 - 2022.0.2 - 0.12.1 + 21 + 2023.0.0 - io.github.crac - org-crac - 0.1.3 + org.crac + crac + 1.4.0 org.springframework.boot @@ -38,11 +38,6 @@ org.springframework.cloud spring-cloud-function-adapter-aws - - org.springframework.experimental - spring-native - ${spring-native.version} - com.amazonaws aws-lambda-java-core @@ -51,12 +46,12 @@ com.amazonaws aws-lambda-java-events - 3.11.1 + 3.11.4 com.amazonaws aws-lambda-java-serialization - 1.0.0 + 1.1.5 software.amazon.awssdk @@ -72,7 +67,8 @@ - + com.amazonaws aws-xray-recorder-sdk-core @@ -110,19 +106,44 @@ software.amazon.awssdk bom - 2.20.51 + 2.22.1 pom import com.amazonaws aws-xray-recorder-sdk-bom - 2.13.0 + 2.15.0 pom import + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.springframework.boot.experimental + spring-boot-thin-layout + 1.0.31.RELEASE + + + + + + org.projectlombok + lombok + + + + + + + jvm @@ -138,25 +159,6 @@ true - - org.springframework.boot - spring-boot-maven-plugin - - - org.springframework.boot.experimental - spring-boot-thin-layout - 1.0.28.RELEASE - - - - - - org.projectlombok - lombok - - - - org.apache.maven.plugins maven-shade-plugin @@ -178,35 +180,15 @@ - - org.springframework.experimental - spring-aot-maven-plugin - ${spring-native.version} - - - test-generate - - test-generate - - - - generate - - generate - - - - org.graalvm.buildtools native-maven-plugin - 0.9.19 true build-native - build + compile-no-fork package @@ -250,17 +232,17 @@ - spring-release - Spring release - https://repo.spring.io/release + spring-milestone + Spring milestone + https://repo.spring.io/milestone - spring-release - Spring release - https://repo.spring.io/release + spring-milestone + Spring milestone + https://repo.spring.io/milestone - + \ No newline at end of file diff --git a/springboot/src/main/java/software/amazonaws/example/product/product/SpringBootSampleApplication.java b/springboot/src/main/java/software/amazonaws/example/product/product/SpringBootSampleApplication.java index 9493b75..9fbc358 100644 --- a/springboot/src/main/java/software/amazonaws/example/product/product/SpringBootSampleApplication.java +++ b/springboot/src/main/java/software/amazonaws/example/product/product/SpringBootSampleApplication.java @@ -3,41 +3,23 @@ package software.amazonaws.example.product.product; -import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; -import com.amazonaws.xray.entities.TraceHeader; -import com.amazonaws.xray.entities.TraceID; -import com.amazonaws.xray.interceptors.TracingInterceptor; import org.joda.time.DateTime; -import software.amazonaws.example.product.product.entity.Product; -import software.amazonaws.example.product.product.entity.Products; - +import org.springframework.aot.hint.annotation.RegisterReflectionForBinding; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.nativex.hint.TypeAccess; -import org.springframework.nativex.hint.TypeHint; +import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent; +import software.amazonaws.example.product.product.entity.Product; +import software.amazonaws.example.product.product.entity.Products; -import java.util.HashSet; @SpringBootApplication -@TypeHint(types = { - DateTime.class, - APIGatewayProxyRequestEvent.class, - TracingInterceptor.class, - HashSet.class, - TraceHeader.class, - TraceID.class -}, - typeNames = { - "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$ProxyRequestContext", - "com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent$RequestIdentity", - "com.amazonaws.xray.entities.TraceHeader$SampleDecision" - }) -@TypeHint( - types = { Product.class, Products.class}, access = { TypeAccess.PUBLIC_CONSTRUCTORS, TypeAccess.PUBLIC_METHODS } -) +@RegisterReflectionForBinding({DateTime.class, APIGatewayProxyRequestEvent.class, Product.class, Products.class}) + public class SpringBootSampleApplication { - public static void main(String[] args) { - SpringApplication.run(SpringBootSampleApplication.class, args); + public static void main(String[] args) { + SpringApplication.run(SpringBootSampleApplication.class, args); + } + } -} + diff --git a/springboot/template.native.arm64.yaml b/springboot/template.native.arm64.yaml index 3e699ea..dae4fe9 100644 --- a/springboot/template.native.arm64.yaml +++ b/springboot/template.native.arm64.yaml @@ -11,7 +11,7 @@ Globals: Tracing: Active CodeUri: target/function-native-zip.zip Handler: org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler - Runtime: provided.al2 + Runtime: provided.al2023 Timeout: 30 MemorySize: 1024 Environment: @@ -30,7 +30,7 @@ Resources: Properties: Environment: Variables: - DEFAULT_HANDLER: getProductById + SPRING_CLOUD_FUNCTION_DEFINITION: getProductByIdFunction Policies: - DynamoDBReadPolicy: TableName: !Ref ProductsTable @@ -47,7 +47,7 @@ Resources: Properties: Environment: Variables: - DEFAULT_HANDLER: getAllProducts + SPRING_CLOUD_FUNCTION_DEFINITION: getAllProductsFunction Policies: - DynamoDBReadPolicy: TableName: !Ref ProductsTable @@ -64,7 +64,7 @@ Resources: Properties: Environment: Variables: - DEFAULT_HANDLER: createProduct + SPRING_CLOUD_FUNCTION_DEFINITION: createProductFunction Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductsTable @@ -81,7 +81,7 @@ Resources: Properties: Environment: Variables: - DEFAULT_HANDLER: deleteProduct + SPRING_CLOUD_FUNCTION_DEFINITION: deleteProductFunction Policies: - DynamoDBCrudPolicy: TableName: !Ref ProductsTable diff --git a/springboot/template.native.yaml b/springboot/template.native.yaml index 6416550..ef660d2 100644 --- a/springboot/template.native.yaml +++ b/springboot/template.native.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/function-native-zip.zip Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest - Runtime: provided + Runtime: provided.al2023 Timeout: 30 MemorySize: 1024 Environment: diff --git a/springboot/template.snapstart.yaml b/springboot/template.snapstart.yaml index 44cdaea..cfb0b3d 100644 --- a/springboot/template.snapstart.yaml +++ b/springboot/template.snapstart.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/springboot-lambda-function-1.0.0-SNAPSHOT-aws.jar Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest - Runtime: java17 + Runtime: java21 Timeout: 30 MemorySize: 1024 AutoPublishAlias: live diff --git a/springboot/template.yaml b/springboot/template.yaml index e70a6d5..3e3f436 100644 --- a/springboot/template.yaml +++ b/springboot/template.yaml @@ -9,7 +9,7 @@ Globals: Tracing: Active CodeUri: target/springboot-lambda-function-1.0.0-SNAPSHOT-aws.jar Handler: org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest - Runtime: java17 + Runtime: java21 Timeout: 30 MemorySize: 1024 Environment: