Browse Source

[ Kotlin / Hexagon ] Benchmark next release (#9563)

* Update dependencies

* Update dependencies

* Update dependencies

* Update dependencies

* Update dependencies

* Fix native image settings

* Change implementations

* Update version

* Add tests for new adapter

* Update dependencies

* Update dependencies
Juanjo Aguililla 5 months ago
parent
commit
83db59049a
40 changed files with 233 additions and 164 deletions
  1. 4 4
      frameworks/Kotlin/hexagon/benchmark_config.json
  2. 10 10
      frameworks/Kotlin/hexagon/build.gradle
  3. 2 2
      frameworks/Kotlin/hexagon/config.toml
  4. 5 5
      frameworks/Kotlin/hexagon/core/build.gradle
  5. 6 6
      frameworks/Kotlin/hexagon/core/src/main/kotlin/Benchmark.kt
  6. 20 20
      frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt
  7. 5 5
      frameworks/Kotlin/hexagon/core/src/main/kotlin/store/BenchmarkStore.kt
  8. 4 1
      frameworks/Kotlin/hexagon/core/src/main/resources/META-INF/native-image/com.hexagonkt.benchmark/core/native-image.properties
  9. 1 1
      frameworks/Kotlin/hexagon/core/src/main/resources/fortunes.jte
  10. 1 1
      frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties
  11. 1 2
      frameworks/Kotlin/hexagon/gradlew
  12. 4 4
      frameworks/Kotlin/hexagon/hexagon-jdk-pgclient.dockerfile
  13. 4 4
      frameworks/Kotlin/hexagon/hexagon-jdk.dockerfile
  14. 1 1
      frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/build.gradle
  15. 9 9
      frameworks/Kotlin/hexagon/hexagon_helidon_pgclient/src/main/kotlin/Benchmark.kt
  16. 1 1
      frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/build.gradle
  17. 8 8
      frameworks/Kotlin/hexagon/hexagon_helidon_postgresql/src/main/kotlin/Benchmark.kt
  18. 7 0
      frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/build.gradle
  19. 25 0
      frameworks/Kotlin/hexagon/hexagon_jdk_pgclient/src/main/kotlin/Benchmark.kt
  20. 8 0
      frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/build.gradle
  21. 25 0
      frameworks/Kotlin/hexagon/hexagon_jdk_postgresql/src/main/kotlin/Benchmark.kt
  22. 1 1
      frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/build.gradle
  23. 9 9
      frameworks/Kotlin/hexagon/hexagon_jetty_pgclient/src/main/kotlin/Benchmark.kt
  24. 1 1
      frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/build.gradle
  25. 9 9
      frameworks/Kotlin/hexagon/hexagon_jetty_postgresql/src/main/kotlin/Benchmark.kt
  26. 1 1
      frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/build.gradle
  27. 8 8
      frameworks/Kotlin/hexagon/hexagon_nettyepoll_pgclient/src/main/kotlin/Benchmark.kt
  28. 1 1
      frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/build.gradle
  29. 8 8
      frameworks/Kotlin/hexagon/hexagon_nettyepoll_postgresql/src/main/kotlin/Benchmark.kt
  30. 1 1
      frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/build.gradle
  31. 13 13
      frameworks/Kotlin/hexagon/hexagon_tomcat_postgresql/src/main/kotlin/WebListenerServer.kt
  32. 1 1
      frameworks/Kotlin/hexagon/model/build.gradle
  33. 3 3
      frameworks/Kotlin/hexagon/model/src/main/kotlin/Settings.kt
  34. 1 1
      frameworks/Kotlin/hexagon/model/src/main/kotlin/model/CachedWorld.kt
  35. 1 1
      frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Fortune.kt
  36. 1 1
      frameworks/Kotlin/hexagon/model/src/main/kotlin/model/Message.kt
  37. 1 1
      frameworks/Kotlin/hexagon/model/src/main/kotlin/model/World.kt
  38. 2 0
      frameworks/Kotlin/hexagon/settings.gradle
  39. 10 10
      frameworks/Kotlin/hexagon/store_pgclient/src/main/kotlin/BenchmarkPgClientStore.kt
  40. 10 10
      frameworks/Kotlin/hexagon/store_sql/src/main/kotlin/BenchmarkSqlStore.kt

+ 4 - 4
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"
             },

+ 10 - 10
frameworks/Kotlin/hexagon/build.gradle

@@ -1,26 +1,26 @@
 
 plugins {
-    id "org.jetbrains.kotlin.jvm" version "2.0.21" apply false
-    id "org.graalvm.buildtools.native" version "0.10.4" apply false
+    id "org.jetbrains.kotlin.jvm" version "2.1.0" apply false
+    id "org.graalvm.buildtools.native" version "0.10.5" apply false
 }
 
 version = "1.0.0"
 description = "TFB benchmark"
-group = "com.hexagonkt"
+group = "com.hexagontk"
 
 ext {
-    hexagonVersion = "3.7.3"
+    hexagonVersion = "4.0.1"
     jettyVersion = "12.0.16"
-    nettyVersion = "4.1.116.Final"
+    nettyVersion = "4.1.118.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"
 }

+ 2 - 2
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"

+ 5 - 5
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") {

+ 6 - 6
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
 

+ 20 - 20
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

+ 5 - 5
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
 

+ 4 - 1
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

+ 1 - 1
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<Fortune> fortunes
 

+ 1 - 1
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

+ 1 - 2
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

+ 4 - 4
frameworks/Kotlin/hexagon/hexagon-jettyloom-pgclient.dockerfile → 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" ]

+ 4 - 4
frameworks/Kotlin/hexagon/hexagon-jettyloom.dockerfile → 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" ]

+ 1 - 1
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")
 }

+ 9 - 9
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"),

+ 1 - 1
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")
 }

+ 8 - 8
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()

+ 7 - 0
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")
+}

+ 25 - 0
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()
+}

+ 8 - 0
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")
+}

+ 25 - 0
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()
+}

+ 1 - 1
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")
 }

+ 9 - 9
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,

+ 1 - 1
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")
 }

+ 9 - 9
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,

+ 1 - 1
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")
 }

+ 8 - 8
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,

+ 1 - 1
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")
 }

+ 8 - 8
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,

+ 1 - 1
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")
 }

+ 13 - 13
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

+ 1 - 1
frameworks/Kotlin/hexagon/model/build.gradle

@@ -1,4 +1,4 @@
 
 dependencies {
-    api("com.hexagonkt:core:$hexagonVersion")
+    api("com.hexagontk:core:$hexagonVersion")
 }

+ 3 - 3
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,

+ 1 - 1
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 1 - 1
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)

+ 2 - 0
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",

+ 10 - 10
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<String>("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<String>("BENCHMARK_ENV")?.lowercase()
+            val poolSize = 8 + if (environment == "citrine") Platform.cpuCount else Platform.cpuCount * 2
+            maxSize = Platform.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize
         }
     }
 

+ 10 - 10
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