Browse Source

http4k: Upgrade GraalVM images to newest versions (JDK21) (#8627)

* Improve performance of update query in pgclient

* Upgrade GraalVM images to newest
David Denton 1 year ago
parent
commit
7bbb956a2f

+ 4 - 4
frameworks/Kotlin/http4k/README.md

@@ -3,7 +3,7 @@
 ## Infrastructure Software Versions
 ## Infrastructure Software Versions
 The tests were run with:
 The tests were run with:
 
 
-* JDK 11
+* JDK 21
 * [http4k](https://http4k.org)
 * [http4k](https://http4k.org)
 
 
 ## Test URLs
 ## Test URLs
@@ -16,10 +16,10 @@ The tests were run with:
 - Plaintext: http://localhost:9000/plaintext
 - Plaintext: http://localhost:9000/plaintext
 
 
 ## Supported backends (w/ Postgres client)
 ## Supported backends (w/ Postgres client)
-- SunHttp/SunHttpLoom (default - bundled with core module - zero dependencies)
+- SunHttp/SunHttpLoom (default - bundled with core module - zero dependencies)  (+ SunHttpLoom w/GraalVM)
 - Apache (5)
 - Apache (5)
-- Apache4
-- Helidon
+- Apache4 (+ w/GraalVM)
+- Helidon (+ w/GraalVM)
 - KtorCIO
 - KtorCIO
 - KtorNetty
 - KtorNetty
 - Jetty/JettyLoom
 - Jetty/JettyLoom

+ 2 - 2
frameworks/Kotlin/http4k/graalvm/src/main/kotlin/http4k/Http4kGraalVMBenchmarkServer.kt

@@ -1,5 +1,5 @@
-import org.http4k.server.SunHttp
+import org.http4k.server.SunHttpLoom
 
 
 fun main() {
 fun main() {
-    Http4kBenchmarkServer(PostgresDatabase()).start(SunHttp(9000))
+    Http4kBenchmarkServer(PostgresDatabase()).start(SunHttpLoom(9000))
 }
 }

+ 11 - 6
frameworks/Kotlin/http4k/http4k-apache-graalvm.dockerfile

@@ -10,16 +10,21 @@ COPY core-pgclient core-pgclient
 COPY apache-graalvm apache-graalvm
 COPY apache-graalvm apache-graalvm
 
 
 RUN gradle --quiet --no-daemon apache-graalvm:shadowJar
 RUN gradle --quiet --no-daemon apache-graalvm:shadowJar
-FROM ghcr.io/graalvm/graalvm-community:21.0.0-ol9-20230919 as graalvm
+
+FROM ghcr.io/graalvm/native-image-community:21 as graalvm
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-apache-graalvm/
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-apache-graalvm/
 COPY --from=gradle /http4k/apache-graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-apache-graalvm/
 COPY --from=gradle /http4k/apache-graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-apache-graalvm/
 COPY --from=gradle /http4k/apache-graalvm/config/*.json /home/app/http4k-apache-graalvm/
 COPY --from=gradle /http4k/apache-graalvm/config/*.json /home/app/http4k-apache-graalvm/
-WORKDIR /home/app/http4k-apache-graalvm
+
 RUN native-image \
 RUN native-image \
-    -H:ReflectionConfigurationFiles=reflect-config.json \
-    -H:ResourceConfigurationFiles=resource-config.json \
+    --static --no-fallback \
+    -H:+UnlockExperimentalVMOptions \
+    -H:ReflectionConfigurationFiles=/home/app/http4k-apache-graalvm/reflect-config.json \
+    -H:ResourceConfigurationFiles=/home/app/http4k-apache-graalvm/resource-config.json \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
-    --no-fallback -cp http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
+    -cp /home/app/http4k-apache-graalvm/http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
 
 
+FROM frolvlad/alpine-glibc
+COPY --from=graalvm /app/http4kgraalvmbenchmarkserverkt /http4kgraalvmbenchmarkserverkt
 EXPOSE 9000
 EXPOSE 9000
-ENTRYPOINT ["/home/app/http4k-apache-graalvm/http4kgraalvmbenchmarkserverkt"]
+ENTRYPOINT ["/http4kgraalvmbenchmarkserverkt"]

+ 11 - 7
frameworks/Kotlin/http4k/http4k-graalvm.dockerfile

@@ -7,19 +7,23 @@ COPY core core
 COPY core-jdbc core-jdbc
 COPY core-jdbc core-jdbc
 COPY core-pgclient core-pgclient
 COPY core-pgclient core-pgclient
 COPY graalvm graalvm
 COPY graalvm graalvm
-COPY sunhttp sunhttp
 
 
 RUN gradle --quiet --no-daemon graalvm:shadowJar
 RUN gradle --quiet --no-daemon graalvm:shadowJar
-FROM ghcr.io/graalvm/graalvm-community:21.0.0-ol9-20230919 as graalvm
+
+FROM ghcr.io/graalvm/native-image-community:21 as graalvm
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-graalvm/
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-graalvm/
 COPY --from=gradle /http4k/graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-graalvm/
 COPY --from=gradle /http4k/graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-graalvm/
 COPY --from=gradle /http4k/graalvm/config/*.json /home/app/http4k-graalvm/
 COPY --from=gradle /http4k/graalvm/config/*.json /home/app/http4k-graalvm/
-WORKDIR /home/app/http4k-graalvm
+
 RUN native-image \
 RUN native-image \
-    -H:ReflectionConfigurationFiles=reflect-config.json \
-    -H:ResourceConfigurationFiles=resource-config.json \
+    --static --no-fallback \
+    -H:+UnlockExperimentalVMOptions \
+    -H:ReflectionConfigurationFiles=/home/app/http4k-graalvm/reflect-config.json \
+    -H:ResourceConfigurationFiles=/home/app/http4k-graalvm/resource-config.json \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
-    --no-fallback -cp http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
+    -cp /home/app/http4k-graalvm/http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
 
 
+FROM frolvlad/alpine-glibc
+COPY --from=graalvm /app/http4kgraalvmbenchmarkserverkt /http4kgraalvmbenchmarkserverkt
 EXPOSE 9000
 EXPOSE 9000
-ENTRYPOINT ["/home/app/http4k-graalvm/http4kgraalvmbenchmarkserverkt"]
+ENTRYPOINT ["/http4kgraalvmbenchmarkserverkt"]

+ 11 - 6
frameworks/Kotlin/http4k/http4k-helidon-graalvm.dockerfile

@@ -10,16 +10,21 @@ COPY helidon-jdbc helidon-jdbc
 COPY helidon-graalvm helidon-graalvm
 COPY helidon-graalvm helidon-graalvm
 
 
 RUN gradle --quiet --no-daemon helidon-graalvm:shadowJar
 RUN gradle --quiet --no-daemon helidon-graalvm:shadowJar
-FROM ghcr.io/graalvm/graalvm-community:21.0.0-ol9-20230919 as graalvm
+
+FROM ghcr.io/graalvm/native-image-community:21 as graalvm
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-helidon-graalvm/
 COPY --from=gradle /http4k/core/src/main/resources/* /home/app/http4k-helidon-graalvm/
 COPY --from=gradle /http4k/helidon-graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-helidon-graalvm/
 COPY --from=gradle /http4k/helidon-graalvm/build/libs/http4k-benchmark.jar /home/app/http4k-helidon-graalvm/
 COPY --from=gradle /http4k/helidon-graalvm/config/*.json /home/app/http4k-helidon-graalvm/
 COPY --from=gradle /http4k/helidon-graalvm/config/*.json /home/app/http4k-helidon-graalvm/
-WORKDIR /home/app/http4k-helidon-graalvm
+
 RUN native-image \
 RUN native-image \
-    -H:ReflectionConfigurationFiles=reflect-config.json \
-    -H:ResourceConfigurationFiles=resource-config.json \
+    --static --no-fallback \
+    -H:+UnlockExperimentalVMOptions \
+    -H:ReflectionConfigurationFiles=/home/app/http4k-helidon-graalvm/reflect-config.json \
+    -H:ResourceConfigurationFiles=/home/app/http4k-helidon-graalvm/resource-config.json \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
     --initialize-at-build-time="org.slf4j.LoggerFactory,org.slf4j.simple.SimpleLogger,org.slf4j.impl.StaticLoggerBinder" \
-    --no-fallback -cp http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
+    -cp /home/app/http4k-helidon-graalvm/http4k-benchmark.jar Http4kGraalVMBenchmarkServerKt
 
 
+FROM frolvlad/alpine-glibc
+COPY --from=graalvm /app/http4kgraalvmbenchmarkserverkt /http4kgraalvmbenchmarkserverkt
 EXPOSE 9000
 EXPOSE 9000
-ENTRYPOINT ["/home/app/http4k-helidon-graalvm/http4kgraalvmbenchmarkserverkt"]
+ENTRYPOINT ["/http4kgraalvmbenchmarkserverkt"]