diff --git a/frameworks/Kotlin/hexagon/benchmark_config.json b/frameworks/Kotlin/hexagon/benchmark_config.json index 8155e24b68c..f858301bddd 100644 --- a/frameworks/Kotlin/hexagon/benchmark_config.json +++ b/frameworks/Kotlin/hexagon/benchmark_config.json @@ -48,7 +48,7 @@ "notes": "http://hexagonkt.com", "versus": "servlet" }, - "jettyloom": { + "jdk": { "json_url": "/json", "db_url": "/db", "query_url": "/query?queries=", @@ -67,11 +67,11 @@ "webserver": "None", "os": "Linux", "database_os": "Linux", - "display_name": "Hexagon Jetty Loom PostgreSQL", + "display_name": "Hexagon JDK PostgreSQL", "notes": "http://hexagonkt.com", "versus": "servlet" }, - "jettyloom-pgclient": { + "jdk-pgclient": { "json_url": "/json", "db_url": "/db", "query_url": "/query?queries=", @@ -90,7 +90,7 @@ "webserver": "None", "os": "Linux", "database_os": "Linux", - "display_name": "Hexagon Jetty Loom PgClient", + "display_name": "Hexagon JDK PgClient", "notes": "http://hexagonkt.com", "versus": "servlet" }, diff --git a/frameworks/Kotlin/hexagon/build.gradle b/frameworks/Kotlin/hexagon/build.gradle index f739a6f3418..2dd26b53971 100644 --- a/frameworks/Kotlin/hexagon/build.gradle +++ b/frameworks/Kotlin/hexagon/build.gradle @@ -1,26 +1,26 @@ plugins { - id "org.jetbrains.kotlin.jvm" version "2.0.21" apply false + id "org.jetbrains.kotlin.jvm" version "2.1.0" apply false id "org.graalvm.buildtools.native" version "0.10.4" apply false } version = "1.0.0" description = "TFB benchmark" -group = "com.hexagonkt" +group = "com.hexagontk" ext { - hexagonVersion = "3.7.3" + hexagonVersion = "4.0.0-B2" jettyVersion = "12.0.16" - nettyVersion = "4.1.116.Final" + nettyVersion = "4.1.117.Final" hikariVersion = "6.2.1" - postgresqlVersion = "42.7.4" - vertxVersion = "4.5.11" + postgresqlVersion = "42.7.5" + vertxVersion = "4.5.12" cache2kVersion = "2.6.1.Final" - applicationClass = "com.hexagonkt.BenchmarkKt" + applicationClass = "com.hexagontk.BenchmarkKt" modules = "java.naming,java.sql,java.management" - gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/$hexagonVersion/gradle" + gradleScripts = "https://raw.githubusercontent.com/hexagontk/hexagon/$hexagonVersion/gradle" } subprojects { @@ -30,5 +30,5 @@ subprojects { } tasks.wrapper { - gradleVersion = "8.10.2" + gradleVersion = "8.12.1" } diff --git a/frameworks/Kotlin/hexagon/config.toml b/frameworks/Kotlin/hexagon/config.toml index 6f25ab27753..c9e89f53241 100644 --- a/frameworks/Kotlin/hexagon/config.toml +++ b/frameworks/Kotlin/hexagon/config.toml @@ -19,7 +19,7 @@ platform = "Servlet" webserver = "None" versus = "servlet" -[jettyloom] +[jdk] urls.plaintext = "/plaintext" urls.json = "/json" urls.db = "/db" @@ -37,7 +37,7 @@ platform = "Servlet" webserver = "None" versus = "servlet" -[jettyloom-pgclient] +[jdk-pgclient] urls.plaintext = "/plaintext" urls.json = "/json" urls.db = "/db" diff --git a/frameworks/Kotlin/hexagon/core/build.gradle b/frameworks/Kotlin/hexagon/core/build.gradle index 18212db6bee..d4d2650a0dc 100644 --- a/frameworks/Kotlin/hexagon/core/build.gradle +++ b/frameworks/Kotlin/hexagon/core/build.gradle @@ -1,16 +1,16 @@ plugins { - id("gg.jte.gradle") version("3.1.4") + id("gg.jte.gradle") version("3.1.13") } dependencies { api(project(":model")) - api("com.hexagonkt:http_server:$hexagonVersion") - api("com.hexagonkt:templates_jte:$hexagonVersion") - api("com.hexagonkt:serialization_jackson_json:$hexagonVersion") + api("com.hexagontk.http:http_server:$hexagonVersion") + api("com.hexagontk.templates:templates_jte:$hexagonVersion") + api("com.hexagontk.serialization:serialization_jackson_json:$hexagonVersion") api("org.cache2k:cache2k-core:$cache2kVersion") - jteGenerate("gg.jte:jte-native-resources:3.1.4") + jteGenerate("gg.jte:jte-native-resources:3.1.13") } tasks.register("minimizeTemplate") { diff --git a/frameworks/Kotlin/hexagon/core/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/core/src/main/kotlin/Benchmark.kt index ef2da876dae..128b84ecbc4 100644 --- a/frameworks/Kotlin/hexagon/core/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/core/src/main/kotlin/Benchmark.kt @@ -1,10 +1,10 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.http.server.HttpServer -import com.hexagonkt.http.server.HttpServerPort -import com.hexagonkt.http.server.HttpServerSettings -import com.hexagonkt.store.BenchmarkStore -import com.hexagonkt.templates.TemplatePort +import com.hexagontk.http.server.HttpServer +import com.hexagontk.http.server.HttpServerPort +import com.hexagontk.http.server.HttpServerSettings +import com.hexagontk.store.BenchmarkStore +import com.hexagontk.templates.TemplatePort import java.net.InetAddress import java.net.URL diff --git a/frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt b/frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt index 5bfd17dfcd5..78b36c61401 100644 --- a/frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt +++ b/frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt @@ -1,21 +1,21 @@ -package com.hexagonkt - -import com.hexagonkt.core.fieldsMapOf -import com.hexagonkt.core.media.APPLICATION_JSON -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.media.TEXT_PLAIN -import com.hexagonkt.http.model.ContentType -import com.hexagonkt.http.model.Header -import com.hexagonkt.http.model.Headers -import com.hexagonkt.http.server.callbacks.DateCallback -import com.hexagonkt.http.handlers.HttpContext -import com.hexagonkt.http.handlers.PathHandler -import com.hexagonkt.http.handlers.path -import com.hexagonkt.model.* -import com.hexagonkt.serialization.jackson.json.Json -import com.hexagonkt.serialization.serialize -import com.hexagonkt.store.BenchmarkStore -import com.hexagonkt.templates.TemplatePort +package com.hexagontk + +import com.hexagontk.core.fieldsMapOf +import com.hexagontk.core.media.APPLICATION_JSON +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.media.TEXT_PLAIN +import com.hexagontk.http.model.ContentType +import com.hexagontk.http.model.Field +import com.hexagontk.http.model.Headers +import com.hexagontk.http.server.callbacks.DateCallback +import com.hexagontk.http.handlers.HttpContext +import com.hexagontk.http.handlers.PathHandler +import com.hexagontk.http.handlers.path +import com.hexagontk.model.* +import com.hexagontk.serialization.jackson.json.Json +import com.hexagontk.serialization.serialize +import com.hexagontk.store.BenchmarkStore +import com.hexagontk.templates.TemplatePort import java.net.URL import java.util.concurrent.ThreadLocalRandom import kotlin.text.Charsets.UTF_8 @@ -35,7 +35,7 @@ class Controller( private val json: ContentType = ContentType(APPLICATION_JSON) private val html: ContentType = ContentType(TEXT_HTML, charset = UTF_8) - private val headers = Headers(Header("server", "Hexagon")) + private val headers = Headers(Field("server", "Hexagon")) val path: PathHandler by lazy { path { @@ -105,7 +105,7 @@ class Controller( ok(body.serialize(Json.raw), contentType = json) private fun HttpContext.getWorldsCount(parameter: String): Int = - request.queryParameters[parameter]?.string()?.toIntOrNull().let { + request.queryParameters[parameter]?.text?.toIntOrNull().let { when { it == null -> 1 it < 1 -> 1 diff --git a/frameworks/Kotlin/hexagon/core/src/main/kotlin/store/BenchmarkStore.kt b/frameworks/Kotlin/hexagon/core/src/main/kotlin/store/BenchmarkStore.kt index 5182fe4ccae..384c81580f9 100644 --- a/frameworks/Kotlin/hexagon/core/src/main/kotlin/store/BenchmarkStore.kt +++ b/frameworks/Kotlin/hexagon/core/src/main/kotlin/store/BenchmarkStore.kt @@ -1,9 +1,9 @@ -package com.hexagonkt.store +package com.hexagontk.store -import com.hexagonkt.model.CachedWorld -import com.hexagonkt.model.Fortune -import com.hexagonkt.Settings -import com.hexagonkt.model.World +import com.hexagontk.model.CachedWorld +import com.hexagontk.model.Fortune +import com.hexagontk.Settings +import com.hexagontk.model.World import org.cache2k.Cache import org.cache2k.Cache2kBuilder diff --git a/frameworks/Kotlin/hexagon/core/src/main/resources/META-INF/native-image/com.hexagonkt.benchmark/core/native-image.properties b/frameworks/Kotlin/hexagon/core/src/main/resources/META-INF/native-image/com.hexagonkt.benchmark/core/native-image.properties index 3c802071a99..50844ff8098 100644 --- a/frameworks/Kotlin/hexagon/core/src/main/resources/META-INF/native-image/com.hexagonkt.benchmark/core/native-image.properties +++ b/frameworks/Kotlin/hexagon/core/src/main/resources/META-INF/native-image/com.hexagonkt.benchmark/core/native-image.properties @@ -3,4 +3,7 @@ Args= \ --static \ --libc=musl \ --gc=G1 \ - --enable-sbom + --enable-sbom \ + --initialize-at-build-time=org.slf4j.LoggerFactory \ + --initialize-at-build-time=org.slf4j.helpers.Reporter \ + --initialize-at-build-time=org.slf4j.LoggerFactoinitialize-at-build-timery diff --git a/frameworks/Kotlin/hexagon/core/src/main/resources/fortunes.jte b/frameworks/Kotlin/hexagon/core/src/main/resources/fortunes.jte index 82b28ce94c3..9c9aabbdb01 100644 --- a/frameworks/Kotlin/hexagon/core/src/main/resources/fortunes.jte +++ b/frameworks/Kotlin/hexagon/core/src/main/resources/fortunes.jte @@ -1,5 +1,5 @@ @import java.util.* -@import com.hexagonkt.model.Fortune +@import com.hexagontk.model.Fortune @param List fortunes diff --git a/frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties b/frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties index df97d72b8b9..e18bc253b85 100644 --- a/frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties +++ b/frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/frameworks/Kotlin/hexagon/gradlew b/frameworks/Kotlin/hexagon/gradlew index f5feea6d6b1..f3b75f3b0d4 100755 --- a/frameworks/Kotlin/hexagon/gradlew +++ b/frameworks/Kotlin/hexagon/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/frameworks/Kotlin/hexagon/hexagon-jettyloom-pgclient.dockerfile b/frameworks/Kotlin/hexagon/hexagon-jdk-pgclient.dockerfile similarity index 63% rename from frameworks/Kotlin/hexagon/hexagon-jettyloom-pgclient.dockerfile rename to frameworks/Kotlin/hexagon/hexagon-jdk-pgclient.dockerfile index 21ef3b64c8b..485fff941e5 100644 --- a/frameworks/Kotlin/hexagon/hexagon-jettyloom-pgclient.dockerfile +++ b/frameworks/Kotlin/hexagon/hexagon-jdk-pgclient.dockerfile @@ -1,7 +1,7 @@ # # BUILD # -FROM docker.io/bellsoft/liberica-runtime-container:jdk-all-21-cds-musl AS build +FROM docker.io/bellsoft/liberica-runtime-container:jdk-all-23-cds-musl AS build USER root WORKDIR /hexagon @@ -12,8 +12,8 @@ RUN ./gradlew --quiet -x test installDist # # RUNTIME # -FROM docker.io/bellsoft/liberica-runtime-container:jre-21-musl -ARG PROJECT=hexagon_jetty_pgclient +FROM docker.io/bellsoft/liberica-runtime-container:jre-23-musl +ARG PROJECT=hexagon_jdk_pgclient ENV POSTGRESQL_DB_HOST tfb-database ENV JDK_JAVA_OPTIONS --enable-preview -XX:+AlwaysPreTouch -XX:+UseParallelGC -XX:+UseNUMA -DvirtualThreads=true @@ -21,4 +21,4 @@ ENV maximumPoolSize 300 COPY --from=build /hexagon/$PROJECT/build/install/$PROJECT /opt/$PROJECT -ENTRYPOINT [ "/opt/hexagon_jetty_pgclient/bin/hexagon_jetty_pgclient" ] +ENTRYPOINT [ "/opt/hexagon_jdk_pgclient/bin/hexagon_jdk_pgclient" ] diff --git a/frameworks/Kotlin/hexagon/hexagon-jettyloom.dockerfile b/frameworks/Kotlin/hexagon/hexagon-jdk.dockerfile similarity index 62% rename from frameworks/Kotlin/hexagon/hexagon-jettyloom.dockerfile rename to frameworks/Kotlin/hexagon/hexagon-jdk.dockerfile index c51c03bc6db..b82e52e1100 100644 --- a/frameworks/Kotlin/hexagon/hexagon-jettyloom.dockerfile +++ b/frameworks/Kotlin/hexagon/hexagon-jdk.dockerfile @@ -1,7 +1,7 @@ # # BUILD # -FROM docker.io/bellsoft/liberica-runtime-container:jdk-all-21-cds-musl AS build +FROM docker.io/bellsoft/liberica-runtime-container:jdk-all-23-cds-musl AS build USER root WORKDIR /hexagon @@ -12,8 +12,8 @@ RUN ./gradlew --quiet -x test installDist # # RUNTIME # -FROM docker.io/bellsoft/liberica-runtime-container:jre-21-musl -ARG PROJECT=hexagon_jetty_postgresql +FROM docker.io/bellsoft/liberica-runtime-container:jre-23-musl +ARG PROJECT=hexagon_jdk_postgresql ENV POSTGRESQL_DB_HOST tfb-database ENV JDK_JAVA_OPTIONS --enable-preview -XX:+AlwaysPreTouch -XX:+UseParallelGC -XX:+UseNUMA -DvirtualThreads=true @@ -21,4 +21,4 @@ ENV maximumPoolSize 300 COPY --from=build /hexagon/$PROJECT/build/install/$PROJECT /opt/$PROJECT -ENTRYPOINT [ "/opt/hexagon_jetty_postgresql/bin/hexagon_jetty_postgresql" ] +ENTRYPOINT [ "/opt/hexagon_jdk_postgresql/bin/hexagon_jdk_postgresql" ] diff --git a/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/build.gradle b/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/build.gradle index 5e64c7bde3f..68a431b25a8 100644 --- a/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/build.gradle @@ -4,5 +4,5 @@ apply(from: "$gradleScripts/native.gradle") dependencies { api(project(":store_pgclient")) - api("com.hexagonkt:http_server_helidon:$hexagonVersion") + api("com.hexagontk.http:http_server_helidon:$hexagonVersion") } diff --git a/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/src/main/kotlin/Benchmark.kt index a5778a2c353..2a97cb6ab07 100644 --- a/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/src/main/kotlin/Benchmark.kt @@ -1,18 +1,18 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.Jvm.systemSettingOrNull -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.helidon.HelidonServerAdapter -import com.hexagonkt.store.BenchmarkPgClientStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.Platform.systemSettingOrNull +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.helidon.HelidonHttpServer +import com.hexagontk.store.BenchmarkPgClientStore +import com.hexagontk.templates.jte.Jte import java.time.Duration fun main() { val store = BenchmarkPgClientStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = HelidonServerAdapter( + val engine = HelidonHttpServer( backlog = systemSettingOrNull("backlog") ?: (8 * 1024), writeQueueLength = systemSettingOrNull("writeQueueLength") ?: (8 * 1024), readTimeout = Duration.parse(systemSettingOrNull("readTimeout") ?: "PT0S"), diff --git a/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/build.gradle b/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/build.gradle index 1fb3fbffab6..2fa5b450d0c 100644 --- a/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/build.gradle @@ -3,5 +3,5 @@ apply(from: "$gradleScripts/application.gradle") dependencies { api(project(":store_sql")) - api("com.hexagonkt:http_server_helidon:$hexagonVersion") + api("com.hexagontk.http:http_server_helidon:$hexagonVersion") } diff --git a/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/src/main/kotlin/Benchmark.kt index cbfb372cbd5..9cbf992c8f4 100644 --- a/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/src/main/kotlin/Benchmark.kt @@ -1,17 +1,17 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.helidon.HelidonServerAdapter -import com.hexagonkt.store.BenchmarkSqlStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.helidon.HelidonHttpServer +import com.hexagontk.store.BenchmarkSqlStore +import com.hexagontk.templates.jte.Jte fun main() { val settings = Settings() val store = BenchmarkSqlStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = HelidonServerAdapter() + val engine = HelidonHttpServer() val benchmark = Benchmark(engine, store, templateEngine, templateUrl, settings) benchmark.server.start() diff --git a/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/build.gradle b/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/build.gradle new file mode 100644 index 00000000000..52bd337daf9 --- /dev/null +++ b/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/build.gradle @@ -0,0 +1,7 @@ + +apply(from: "$gradleScripts/application.gradle") + +dependencies { + api(project(":store_pgclient")) + api("com.hexagontk.http:http_server_jdk:$hexagonVersion") +} diff --git a/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/src/main/kotlin/Benchmark.kt new file mode 100644 index 00000000000..d5cdace42f1 --- /dev/null +++ b/frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/src/main/kotlin/Benchmark.kt @@ -0,0 +1,25 @@ +package com.hexagontk + +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.jdk.JdkHttpServer +import com.hexagontk.store.BenchmarkPgClientStore +import com.hexagontk.templates.jte.Jte +import java.util.concurrent.Executors.newVirtualThreadPerTaskExecutor + +fun main() { + System.setProperty("sun.net.httpserver.idleInterval", "5") + System.setProperty("sun.net.httpserver.maxIdleConnections", "400") + + val settings = Settings() + val store = BenchmarkPgClientStore("postgresql") + val templateEngine = Jte(TEXT_HTML, precompiled = true) + val templateUrl = urlOf("classpath:fortunes.jte") + val engine = JdkHttpServer( + executor = newVirtualThreadPerTaskExecutor(), + backlog = 2_048 + ) + + val benchmark = Benchmark(engine, store, templateEngine, templateUrl, settings) + benchmark.server.start() +} diff --git a/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/build.gradle b/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/build.gradle new file mode 100644 index 00000000000..b1ea253c073 --- /dev/null +++ b/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/build.gradle @@ -0,0 +1,8 @@ + +apply(from: "$gradleScripts/application.gradle") +apply(from: "$gradleScripts/native.gradle") + +dependencies { + api(project(":store_sql")) + api("com.hexagontk.http:http_server_jdk:$hexagonVersion") +} diff --git a/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/src/main/kotlin/Benchmark.kt new file mode 100644 index 00000000000..67d2a3dfba2 --- /dev/null +++ b/frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/src/main/kotlin/Benchmark.kt @@ -0,0 +1,25 @@ +package com.hexagontk + +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.jdk.JdkHttpServer +import com.hexagontk.store.BenchmarkSqlStore +import com.hexagontk.templates.jte.Jte +import java.util.concurrent.Executors.newVirtualThreadPerTaskExecutor + +fun main() { + System.setProperty("sun.net.httpserver.idleInterval", "5") + System.setProperty("sun.net.httpserver.maxIdleConnections", "400") + + val settings = Settings() + val store = BenchmarkSqlStore("postgresql") + val templateEngine = Jte(TEXT_HTML, precompiled = true) + val templateUrl = urlOf("classpath:fortunes.jte") + val engine = JdkHttpServer( + executor = newVirtualThreadPerTaskExecutor(), + backlog = 2_048 + ) + + val benchmark = Benchmark(engine, store, templateEngine, templateUrl, settings) + benchmark.server.start() +} diff --git a/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/build.gradle b/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/build.gradle index 3b3d4b51b92..a9c2a1b12d2 100644 --- a/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/build.gradle @@ -3,5 +3,5 @@ apply(from: "$gradleScripts/application.gradle") dependencies { api(project(":store_pgclient")) - api("com.hexagonkt:http_server_jetty:$hexagonVersion") + api("com.hexagontk.http:http_server_jetty:$hexagonVersion") } diff --git a/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/src/main/kotlin/Benchmark.kt index c6e8dbcf855..54efe59c383 100644 --- a/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/src/main/kotlin/Benchmark.kt @@ -1,18 +1,18 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.Jvm.systemFlag -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.jetty.JettyServletAdapter -import com.hexagonkt.store.BenchmarkPgClientStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.Platform.systemFlag +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.jetty.JettyServletHttpServer +import com.hexagontk.store.BenchmarkPgClientStore +import com.hexagontk.templates.jte.Jte fun main() { val settings = Settings() val store = BenchmarkPgClientStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = JettyServletAdapter( + val engine = JettyServletHttpServer( sendDateHeader = settings.sendDateHeader, sendServerVersion = settings.sendServerVersion, sendXPoweredBy = settings.sendXPoweredBy, diff --git a/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/build.gradle b/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/build.gradle index 059804ac9ff..5576046c945 100644 --- a/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/build.gradle @@ -4,5 +4,5 @@ apply(from: "$gradleScripts/native.gradle") dependencies { api(project(":store_sql")) - api("com.hexagonkt:http_server_jetty:$hexagonVersion") + api("com.hexagontk.http:http_server_jetty:$hexagonVersion") } diff --git a/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/src/main/kotlin/Benchmark.kt index 64585b785b6..40d654f2a7f 100644 --- a/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/src/main/kotlin/Benchmark.kt @@ -1,18 +1,18 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.Jvm.systemFlag -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.jetty.JettyServletAdapter -import com.hexagonkt.store.BenchmarkSqlStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.Platform.systemFlag +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.jetty.JettyServletHttpServer +import com.hexagontk.store.BenchmarkSqlStore +import com.hexagontk.templates.jte.Jte fun main() { val settings = Settings() val store = BenchmarkSqlStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = JettyServletAdapter( + val engine = JettyServletHttpServer( sendDateHeader = settings.sendDateHeader, sendServerVersion = settings.sendServerVersion, sendXPoweredBy = settings.sendXPoweredBy, diff --git a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/build.gradle b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/build.gradle index 0017123ec54..2a8b788a99f 100644 --- a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/build.gradle @@ -3,6 +3,6 @@ apply(from: "$gradleScripts/application.gradle") dependencies { api(project(":store_pgclient")) - api("com.hexagonkt:http_server_netty_epoll:$hexagonVersion") + api("com.hexagontk.http:http_server_netty_epoll:$hexagonVersion") api("io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64") } diff --git a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/src/main/kotlin/Benchmark.kt index 0bbd8038edd..f094b7bc217 100644 --- a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/src/main/kotlin/Benchmark.kt @@ -1,10 +1,10 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.netty.epoll.NettyEpollServerAdapter -import com.hexagonkt.store.BenchmarkPgClientStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.netty.epoll.NettyEpollHttpServer +import com.hexagontk.store.BenchmarkPgClientStore +import com.hexagontk.templates.jte.Jte import io.netty.util.ResourceLeakDetector import io.netty.util.ResourceLeakDetector.Level.DISABLED @@ -16,9 +16,9 @@ fun main() { val settings = Settings() val store = BenchmarkPgClientStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = NettyEpollServerAdapter( + val engine = NettyEpollHttpServer( keepAliveHandler = false, httpAggregatorHandler = false, chunkedHandler = false, diff --git a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/build.gradle b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/build.gradle index 243fa57c121..3c142f1f1c6 100644 --- a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/build.gradle @@ -3,6 +3,6 @@ apply(from: "$gradleScripts/application.gradle") dependencies { api(project(":store_sql")) - api("com.hexagonkt:http_server_netty_epoll:$hexagonVersion") + api("com.hexagontk.http:http_server_netty_epoll:$hexagonVersion") api("io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64") } diff --git a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/src/main/kotlin/Benchmark.kt b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/src/main/kotlin/Benchmark.kt index 77fa370b915..eaba3b48b40 100644 --- a/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/src/main/kotlin/Benchmark.kt +++ b/frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/src/main/kotlin/Benchmark.kt @@ -1,10 +1,10 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.server.netty.epoll.NettyEpollServerAdapter -import com.hexagonkt.store.BenchmarkSqlStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.server.netty.epoll.NettyEpollHttpServer +import com.hexagontk.store.BenchmarkSqlStore +import com.hexagontk.templates.jte.Jte import io.netty.util.ResourceLeakDetector import io.netty.util.ResourceLeakDetector.Level.DISABLED @@ -16,9 +16,9 @@ fun main() { val settings = Settings() val store = BenchmarkSqlStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") - val engine = NettyEpollServerAdapter( + val engine = NettyEpollHttpServer( keepAliveHandler = false, httpAggregatorHandler = false, chunkedHandler = false, diff --git a/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/build.gradle b/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/build.gradle index 3c72b9d4b0a..ca5fd01a071 100644 --- a/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/build.gradle +++ b/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/build.gradle @@ -9,7 +9,7 @@ build.dependsOn("war") dependencies { api(project(":store_sql")) - api("com.hexagonkt:http_server_servlet:$hexagonVersion") + api("com.hexagontk.http:http_server_servlet:$hexagonVersion") compileOnly("jakarta.servlet:jakarta.servlet-api:5.0.0") } diff --git a/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/src/main/kotlin/WebListenerServer.kt b/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/src/main/kotlin/WebListenerServer.kt index c7d7ea4449c..d50232ab974 100644 --- a/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/src/main/kotlin/WebListenerServer.kt +++ b/frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/src/main/kotlin/WebListenerServer.kt @@ -1,15 +1,15 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.media.TEXT_HTML -import com.hexagonkt.core.urlOf -import com.hexagonkt.http.model.Header -import com.hexagonkt.http.model.Headers -import com.hexagonkt.http.handlers.HttpHandler -import com.hexagonkt.http.handlers.OnHandler -import com.hexagonkt.http.handlers.PathHandler -import com.hexagonkt.http.server.servlet.ServletServer -import com.hexagonkt.store.BenchmarkSqlStore -import com.hexagonkt.templates.jte.JteAdapter +import com.hexagontk.core.media.TEXT_HTML +import com.hexagontk.core.urlOf +import com.hexagontk.http.model.Field +import com.hexagontk.http.model.Headers +import com.hexagontk.http.handlers.HttpHandler +import com.hexagontk.http.handlers.OnHandler +import com.hexagontk.http.handlers.PathHandler +import com.hexagontk.http.server.servlet.ServletServer +import com.hexagontk.store.BenchmarkSqlStore +import com.hexagontk.templates.jte.Jte import jakarta.servlet.annotation.WebListener @WebListener class WebListenerServer( @@ -17,11 +17,11 @@ import jakarta.servlet.annotation.WebListener ) : ServletServer(createHandlers(settings)) { private companion object { - val headers = Headers(Header("server", "Tomcat")) + val headers = Headers(Field("server", "Tomcat")) fun createHandlers(settings: Settings): HttpHandler { val store = BenchmarkSqlStore("postgresql") - val templateEngine = JteAdapter(TEXT_HTML, precompiled = true) + val templateEngine = Jte(TEXT_HTML, precompiled = true) val templateUrl = urlOf("classpath:fortunes.jte") val controller = Controller(settings, store, templateEngine, templateUrl) val controllerPath = controller.path diff --git a/frameworks/Kotlin/hexagon/model/build.gradle b/frameworks/Kotlin/hexagon/model/build.gradle index bb97bfd9a3d..a606fb03967 100644 --- a/frameworks/Kotlin/hexagon/model/build.gradle +++ b/frameworks/Kotlin/hexagon/model/build.gradle @@ -1,4 +1,4 @@ dependencies { - api("com.hexagonkt:core:$hexagonVersion") + api("com.hexagontk:core:$hexagonVersion") } diff --git a/frameworks/Kotlin/hexagon/model/src/main/kotlin/Settings.kt b/frameworks/Kotlin/hexagon/model/src/main/kotlin/Settings.kt index b11ed02c9e9..70fdd0f5b81 100644 --- a/frameworks/Kotlin/hexagon/model/src/main/kotlin/Settings.kt +++ b/frameworks/Kotlin/hexagon/model/src/main/kotlin/Settings.kt @@ -1,7 +1,7 @@ -package com.hexagonkt +package com.hexagontk -import com.hexagonkt.core.Jvm.systemFlag -import com.hexagonkt.core.Jvm.systemSettingOrNull +import com.hexagontk.core.Platform.systemFlag +import com.hexagontk.core.Platform.systemSettingOrNull data class Settings( val bindPort: Int = systemSettingOrNull("bindPort") ?: 9090, diff --git a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/CachedWorld.kt b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/CachedWorld.kt index 101176e3c39..edfa5ee0ec5 100644 --- a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/CachedWorld.kt +++ b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/CachedWorld.kt @@ -1,3 +1,3 @@ -package com.hexagonkt.model +package com.hexagontk.model data class CachedWorld(val id: Int, val randomNumber: Int) diff --git a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Fortune.kt b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Fortune.kt index b4781735ec1..a8061b81db3 100644 --- a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Fortune.kt +++ b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Fortune.kt @@ -1,3 +1,3 @@ -package com.hexagonkt.model +package com.hexagontk.model data class Fortune(val id: Int, val message: String) diff --git a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Message.kt b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Message.kt index 090dcbf0be6..3231b8bd961 100644 --- a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Message.kt +++ b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Message.kt @@ -1,3 +1,3 @@ -package com.hexagonkt.model +package com.hexagontk.model data class Message(val message: String) diff --git a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/World.kt b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/World.kt index 5f3316f9a5a..347e00e608f 100644 --- a/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/World.kt +++ b/frameworks/Kotlin/hexagon/model/src/main/kotlin/model/World.kt @@ -1,3 +1,3 @@ -package com.hexagonkt.model +package com.hexagontk.model data class World(val id: Int, val randomNumber: Int) diff --git a/frameworks/Kotlin/hexagon/settings.gradle b/frameworks/Kotlin/hexagon/settings.gradle index f7b97fb2582..2636b07ef6a 100644 --- a/frameworks/Kotlin/hexagon/settings.gradle +++ b/frameworks/Kotlin/hexagon/settings.gradle @@ -9,6 +9,8 @@ include( "hexagon_jetty_postgresql", "hexagon_helidon_pgclient", "hexagon_helidon_postgresql", + "hexagon_jdk_pgclient", + "hexagon_jdk_postgresql", "hexagon_nettyepoll_pgclient", "hexagon_nettyepoll_postgresql", "hexagon_tomcat_postgresql", diff --git a/frameworks/Kotlin/hexagon/store_pgclient/src/main/kotlin/BenchmarkPgClientStore.kt b/frameworks/Kotlin/hexagon/store_pgclient/src/main/kotlin/BenchmarkPgClientStore.kt index 2b09d73f6f5..02359461502 100644 --- a/frameworks/Kotlin/hexagon/store_pgclient/src/main/kotlin/BenchmarkPgClientStore.kt +++ b/frameworks/Kotlin/hexagon/store_pgclient/src/main/kotlin/BenchmarkPgClientStore.kt @@ -1,10 +1,10 @@ -package com.hexagonkt.store +package com.hexagontk.store -import com.hexagonkt.Settings -import com.hexagonkt.core.Jvm -import com.hexagonkt.model.CachedWorld -import com.hexagonkt.model.Fortune -import com.hexagonkt.model.World +import com.hexagontk.Settings +import com.hexagontk.core.Platform +import com.hexagontk.model.CachedWorld +import com.hexagontk.model.Fortune +import com.hexagontk.model.World import io.vertx.core.Future import io.vertx.core.Vertx import io.vertx.core.VertxOptions @@ -27,7 +27,7 @@ class BenchmarkPgClientStore( private val connectOptions: PgConnectOptions by lazy { PgConnectOptions().apply { - host = Jvm.systemSettingOrNull("${engine.uppercase()}_DB_HOST") ?: "tfb-database" + host = Platform.systemSettingOrNull("${engine.uppercase()}_DB_HOST") ?: "tfb-database" database = settings.databaseName user = settings.databaseUsername password = settings.databasePassword @@ -37,9 +37,9 @@ class BenchmarkPgClientStore( private val poolOptions: PoolOptions by lazy { PoolOptions().apply { - val environment = Jvm.systemSettingOrNull("BENCHMARK_ENV")?.lowercase() - val poolSize = 8 + if (environment == "citrine") Jvm.cpuCount else Jvm.cpuCount * 2 - maxSize = Jvm.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize + val environment = Platform.systemSettingOrNull("BENCHMARK_ENV")?.lowercase() + val poolSize = 8 + if (environment == "citrine") Platform.cpuCount else Platform.cpuCount * 2 + maxSize = Platform.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize } } diff --git a/frameworks/Kotlin/hexagon/store_sql/src/main/kotlin/BenchmarkSqlStore.kt b/frameworks/Kotlin/hexagon/store_sql/src/main/kotlin/BenchmarkSqlStore.kt index 14558b1a2bd..126a9fc946a 100644 --- a/frameworks/Kotlin/hexagon/store_sql/src/main/kotlin/BenchmarkSqlStore.kt +++ b/frameworks/Kotlin/hexagon/store_sql/src/main/kotlin/BenchmarkSqlStore.kt @@ -1,10 +1,10 @@ -package com.hexagonkt.store +package com.hexagontk.store -import com.hexagonkt.model.CachedWorld -import com.hexagonkt.model.Fortune -import com.hexagonkt.Settings -import com.hexagonkt.model.World -import com.hexagonkt.core.Jvm +import com.hexagontk.model.CachedWorld +import com.hexagontk.model.Fortune +import com.hexagontk.Settings +import com.hexagontk.model.World +import com.hexagontk.core.Platform import com.zaxxer.hikari.HikariConfig import com.zaxxer.hikari.HikariDataSource import org.cache2k.Cache @@ -23,9 +23,9 @@ class BenchmarkSqlStore( } private val dataSource: HikariDataSource by lazy { - val dbHost = Jvm.systemSettingOrNull("${engine.uppercase()}_DB_HOST") ?: "tfb-database" - val environment = Jvm.systemSettingOrNull(String::class, "BENCHMARK_ENV")?.lowercase() - val poolSize = 8 + if (environment == "citrine") Jvm.cpuCount else Jvm.cpuCount * 2 + val dbHost = Platform.systemSettingOrNull("${engine.uppercase()}_DB_HOST") ?: "tfb-database" + val environment = Platform.systemSettingOrNull(String::class, "BENCHMARK_ENV")?.lowercase() + val poolSize = 8 + if (environment == "citrine") Platform.cpuCount else Platform.cpuCount * 2 val postgresqlSettings = listOf( "ssl=false", "assumeMinServerVersion=12.10", @@ -35,7 +35,7 @@ class BenchmarkSqlStore( ).joinToString("&") val config = HikariConfig().apply { jdbcUrl = "jdbc:postgresql://$dbHost/${settings.databaseName}?$postgresqlSettings" - maximumPoolSize = Jvm.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize + maximumPoolSize = Platform.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize driverClassName = settings.databaseDriver username = settings.databaseUsername password = settings.databasePassword