Browse Source

Upgrade http4k, add Cached test, add backends, tidy configs for clarity (#5950)

* Upgrade http4k, add Cached test, add backends, tidy configs for clarity

* readd apache 5

* replace plaintext route with simpler implementation
David Denton 5 years ago
parent
commit
f97720f8a8
25 changed files with 237 additions and 112 deletions
  1. 3 1
      frameworks/Kotlin/http4k/.gitignore
  2. 11 7
      frameworks/Kotlin/http4k/README.md
  3. 1 1
      frameworks/Kotlin/http4k/apache/src/main/kotlin/Http4kApacheServer.kt
  4. 15 0
      frameworks/Kotlin/http4k/apache4/build.gradle
  5. 6 0
      frameworks/Kotlin/http4k/apache4/src/main/kotlin/Http4kApache4Server.kt
  6. 78 26
      frameworks/Kotlin/http4k/benchmark_config.json
  7. 1 1
      frameworks/Kotlin/http4k/build.gradle
  8. 5 4
      frameworks/Kotlin/http4k/core/build.gradle
  9. 41 4
      frameworks/Kotlin/http4k/core/src/main/kotlin/Database.kt
  10. 2 2
      frameworks/Kotlin/http4k/core/src/main/kotlin/FortunesRoute.kt
  11. 2 1
      frameworks/Kotlin/http4k/core/src/main/kotlin/Http4kBenchmarkServer.kt
  12. 5 5
      frameworks/Kotlin/http4k/core/src/main/kotlin/PlainTextRoute.kt
  13. 11 3
      frameworks/Kotlin/http4k/core/src/main/kotlin/WorldRoutes.kt
  14. 2 8
      frameworks/Kotlin/http4k/http4k-apache.dockerfile
  15. 9 0
      frameworks/Kotlin/http4k/http4k-apache4.dockerfile
  16. 9 0
      frameworks/Kotlin/http4k/http4k-jetty.dockerfile
  17. 2 8
      frameworks/Kotlin/http4k/http4k-ktorcio.dockerfile
  18. 2 8
      frameworks/Kotlin/http4k/http4k-ktornetty.dockerfile
  19. 2 8
      frameworks/Kotlin/http4k/http4k-netty.dockerfile
  20. 2 8
      frameworks/Kotlin/http4k/http4k-ratpack.dockerfile
  21. 2 8
      frameworks/Kotlin/http4k/http4k-undertow.dockerfile
  22. 4 9
      frameworks/Kotlin/http4k/http4k.dockerfile
  23. 2 0
      frameworks/Kotlin/http4k/settings.gradle
  24. 14 0
      frameworks/Kotlin/http4k/sunhttp/build.gradle
  25. 6 0
      frameworks/Kotlin/http4k/sunhttp/src/main/kotlin/Http4kSunHttpServer.kt

+ 3 - 1
frameworks/Kotlin/http4k/.gitignore

@@ -2,4 +2,6 @@ build
 out
 docker
 .idea
-.gradle
+.gradle
+/gradlew
+/gradlew.bat

+ 11 - 7
frameworks/Kotlin/http4k/README.md

@@ -12,15 +12,19 @@ The tests were run with:
 - Multiple queries: http://localhost:9000/queries
 - Fortunes: http://localhost:9000/fortunes
 - Updates: http://localhost:9000/updates
+- Cached: http://localhost:9000/cached
 - Plaintext: http://localhost:9000/plaintext
 
-## Supported backends
-- Apache (w/ Postgres + Reactive PG clienta)
-- KtorCIO (w/ Postgres client)
-- KtorNetty (w/ Postgres client)
-- Jetty (w/ Postgres client)
-- Netty (w/ Postgres client)
-- Undertow (w/ Postgres client)
+## Supported backends (w/ Postgres client)
+- SunHttp (default - bundled with core module - zero dependencies)
+- Apache (5)
+- Apache4
+- KtorCIO
+- KtorNetty
+- Jetty
+- Netty
+- Ratpack
+- Undertow
 
 ## How to run example
 ```bash

+ 1 - 1
frameworks/Kotlin/http4k/apache/src/main/kotlin/Http4kApacheServer.kt

@@ -2,5 +2,5 @@
 import org.http4k.server.ApacheServer
 
 fun main() {
-    Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(ApacheServer(9000))
+    Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(ApacheServer(9000, canonicalHostname = "tfb-server"))
 }

+ 15 - 0
frameworks/Kotlin/http4k/apache4/build.gradle

@@ -0,0 +1,15 @@
+dependencies {
+    compile project(":core")
+    compile "org.http4k:http4k-server-apache4:$http4k_version"
+}
+
+apply plugin: 'application'
+mainClassName = "Http4kApache4ServerKt"
+apply plugin: 'com.github.johnrengelman.shadow'
+
+shadowJar {
+    baseName = "http4k-$project.name-benchmark"
+    classifier = null
+    version = null
+    mergeServiceFiles()
+}

+ 6 - 0
frameworks/Kotlin/http4k/apache4/src/main/kotlin/Http4kApache4Server.kt

@@ -0,0 +1,6 @@
+
+import org.http4k.server.Apache4Server
+
+fun main() {
+    Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(Apache4Server(9000))
+}

+ 78 - 26
frameworks/Kotlin/http4k/benchmark_config.json

@@ -5,6 +5,7 @@
       "default": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -17,15 +18,17 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "servlet",
+        "platform": "sunhttp",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
+        "notes": "https://http4k.org",
+        "display_name": "http4k-core",
         "versus": "servlet"
       },
-      "undertow": {
+      "apache": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -38,15 +41,16 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "undertow",
+        "platform": "apache-httpcore",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "undertow"
+        "notes": "https://http4k.org",
+        "versus": "servlet"
       },
-      "ratpack": {
+      "apache4": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -59,15 +63,16 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "ratpack",
+        "platform": "apache-httpcore",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "ratpack"
+        "notes": "https://http4k.org",
+        "versus": "servlet"
       },
-      "netty": {
+      "jetty": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -80,15 +85,16 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "netty",
+        "platform": "jetty",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "netty"
+        "notes": "https://http4k.org",
+        "versus": "jetty"
       },
-      "apache": {
+      "ktorcio": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -101,15 +107,16 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "apache-httpcore",
+        "platform": "ktor",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "servlet"
+        "notes": "https://http4k.org",
+        "versus": "ktor-cio"
       },
-      "ktorcio": {
+      "ktornetty": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -122,15 +129,16 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "ktorcio",
+        "platform": "ktor",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "ktor-cio"
+        "notes": "https://http4k.org",
+        "versus": "ktor-netty"
       },
-      "ktornetty": {
+      "netty": {
         "orm": "Raw",
         "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
@@ -143,11 +151,55 @@
         "classification": "Micro",
         "framework": "http4k",
         "language": "Kotlin",
-        "platform": "ktornetty",
+        "platform": "netty",
         "webserver": "None",
         "os": "Linux",
-        "notes": "",
-        "versus": "ktor-netty"
+        "notes": "https://http4k.org",
+        "versus": "netty"
+      },
+      "ratpack": {
+        "orm": "Raw",
+        "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
+        "db_url": "/db",
+        "fortune_url": "/fortunes",
+        "query_url": "/queries?queries=",
+        "update_url": "/updates?queries=",
+        "database": "Postgres",
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 9000,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "framework": "http4k",
+        "language": "Kotlin",
+        "platform": "netty",
+        "webserver": "None",
+        "os": "Linux",
+        "notes": "https://http4k.org",
+        "versus": "ratpack"
+      },
+      "undertow": {
+        "orm": "Raw",
+        "database_os": "Linux",
+        "cached_query_url": "/cached?queries=",
+        "db_url": "/db",
+        "fortune_url": "/fortunes",
+        "query_url": "/queries?queries=",
+        "update_url": "/updates?queries=",
+        "database": "Postgres",
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 9000,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "framework": "http4k",
+        "language": "Kotlin",
+        "platform": "undertow",
+        "webserver": "None",
+        "os": "Linux",
+        "notes": "https://http4k.org",
+        "versus": "undertow"
       }
     }
   ]

+ 1 - 1
frameworks/Kotlin/http4k/build.gradle

@@ -1,6 +1,6 @@
 buildscript {
     ext.kotlin_version = "1.3.72"
-    ext.http4k_version = "3.249.0"
+    ext.http4k_version = "3.259.0"
 
     repositories {
         mavenCentral()

+ 5 - 4
frameworks/Kotlin/http4k/core/build.gradle

@@ -4,8 +4,9 @@ dependencies {
     compile "org.http4k:http4k-core:$http4k_version"
     compile "org.http4k:http4k-format-jackson:$http4k_version"
     compile "org.http4k:http4k-template-pebble:$http4k_version"
-    compile "org.apache.commons:commons-lang3:3.7"
-    compile "com.zaxxer:HikariCP:3.3.1"
-    compile "org.postgresql:postgresql:42.2.5"
-    compile "io.reactiverse:reactive-pg-client:0.11.3"
+    compile "org.apache.commons:commons-lang3:3.11"
+    compile "com.zaxxer:HikariCP:3.4.5"
+    compile "org.postgresql:postgresql:42.2.16"
+    compile "org.cache2k:cache2k-base-bom:1.2.4.Final"
+
 }

+ 41 - 4
frameworks/Kotlin/http4k/core/src/main/kotlin/Database.kt

@@ -1,6 +1,8 @@
 import com.fasterxml.jackson.databind.JsonNode
 import com.zaxxer.hikari.HikariConfig
 import com.zaxxer.hikari.HikariDataSource
+import org.cache2k.Cache2kBuilder
+import org.cache2k.IntCache
 import org.http4k.format.Jackson.number
 import org.http4k.format.Jackson.obj
 import java.sql.Connection
@@ -11,17 +13,44 @@ import javax.sql.DataSource
 
 interface Database {
     fun findWorld(): JsonNode
+    fun loadAll(): Map<Int, JsonNode>
     fun findWorlds(count: Int): List<JsonNode>
     fun updateWorlds(count: Int): List<JsonNode>
     fun fortunes(): List<Fortune>
 }
 
-class PostgresDatabase private constructor(private val dataSource: DataSource) : Database {
+private const val TOTAL_DB_ROWS = 10000
+
+class CachedDatabase(private val delegate: Database) : Database by delegate {
+    private val cache = object : Cache2kBuilder<Int, JsonNode>() {}
+        .name("cachedWorld")
+        .eternal(true)
+        .entryCapacity(TOTAL_DB_ROWS.toLong())
+        .buildForIntKey()
+        .apply {
+            refresh()
+        }
 
-    override fun findWorld() = withConnection {
-        findWorld(randomWorld())
+    private fun IntCache<JsonNode>.refresh() {
+        putAll(delegate.loadAll())
     }
 
+    override fun findWorlds(count: Int) = (1..count).map { cache.peek(randomWorld()) }
+
+    override fun updateWorlds(count: Int) =
+        delegate.updateWorlds(count).apply {
+            cache.refresh() // massively inefficient, but :shrug:
+        }
+
+    override fun loadAll(): Map<Int, JsonNode> = cache.asMap()
+}
+
+class PostgresDatabase private constructor(private val dataSource: DataSource) : Database {
+
+    override fun findWorld() = withConnection { findWorld(randomWorld()) }
+
+    override fun loadAll(): Map<Int, JsonNode> = withConnection { findAll() }
+
     override fun findWorlds(count: Int) = withConnection {
         (1..count).map { findWorld(randomWorld()) }
     }
@@ -84,6 +113,14 @@ class PostgresDatabase private constructor(private val dataSource: DataSource) :
             }.first()
         }
 
+    private fun Connection.findAll() =
+        withStatement("SELECT * FROM world") {
+            executeQuery().toResultsList {
+                val id = getInt("id")
+                id to obj("id" to number(id), "randomNumber" to number(getInt("randomNumber")))
+            }.toMap()
+        }
+
     private inline fun <T> ResultSet.toResultsList(fn: ResultSet.() -> T): List<T> =
         mutableListOf<T>().apply {
             while (next()) {
@@ -92,4 +129,4 @@ class PostgresDatabase private constructor(private val dataSource: DataSource) :
         }
 }
 
-private fun randomWorld() = Random().nextInt(9999) + 1
+private fun randomWorld() = Random().nextInt(TOTAL_DB_ROWS - 1) + 1

+ 2 - 2
frameworks/Kotlin/http4k/core/src/main/kotlin/FortunesRoute.kt

@@ -7,14 +7,14 @@ import org.http4k.core.with
 import org.http4k.routing.bind
 import org.http4k.template.PebbleTemplates
 import org.http4k.template.ViewModel
-import org.http4k.template.view
+import org.http4k.template.viewModel
 
 data class Fortune(val id: Int, val message: String)
 
 data class FortunesList(val items: List<Fortune>) : ViewModel
 
 object FortunesRoute {
-    private val viewBody = Body.view(PebbleTemplates().CachingClasspath(), TEXT_HTML)
+    private val viewBody = Body.viewModel(PebbleTemplates().CachingClasspath(), TEXT_HTML).toLens()
 
     operator fun invoke(db: Database) = "/fortunes" bind GET to {
         Response(OK).with(viewBody of FortunesList(db.fortunes()))

+ 2 - 1
frameworks/Kotlin/http4k/core/src/main/kotlin/Http4kBenchmarkServer.kt

@@ -30,7 +30,8 @@ object Http4kBenchmarkServer {
                             FortunesRoute(database),
                             WorldRoutes.queryRoute(database),
                             WorldRoutes.updateRoute(database),
-                            WorldRoutes.multipleRoute(database)
+                            WorldRoutes.multipleRoute(database),
+                            WorldRoutes.cachedRoute(database)
                     )
             )
 }

+ 5 - 5
frameworks/Kotlin/http4k/core/src/main/kotlin/PlainTextRoute.kt

@@ -1,17 +1,17 @@
-import org.http4k.asByteBuffer
 import org.http4k.core.Body
 import org.http4k.core.ContentType.Companion.TEXT_PLAIN
 import org.http4k.core.Method.GET
 import org.http4k.core.Response
 import org.http4k.core.Status.Companion.OK
 import org.http4k.core.with
+import org.http4k.lens.Header.CONTENT_TYPE
 import org.http4k.lens.binary
 import org.http4k.routing.bind
 
 object PlainTextRoute {
-    private val preAllocatedHelloWorldText = "Hello, World!".asByteBuffer()
+    private const val preAllocatedHelloWorldText = "Hello, World!"
 
-    private val plainTextBody = Body.binary(TEXT_PLAIN).toLens()
-
-    operator fun invoke() = "/plaintext" bind GET to { Response(OK).with(plainTextBody of Body(preAllocatedHelloWorldText)) }
+    operator fun invoke() = "/plaintext" bind GET to {
+        Response(OK).body(preAllocatedHelloWorldText).with(CONTENT_TYPE of TEXT_PLAIN)
+    }
 }

+ 11 - 3
frameworks/Kotlin/http4k/core/src/main/kotlin/WorldRoutes.kt

@@ -1,4 +1,3 @@
-
 import org.http4k.core.Body
 import org.http4k.core.Method.GET
 import org.http4k.core.Response
@@ -7,9 +6,10 @@ import org.http4k.core.with
 import org.http4k.format.Jackson.array
 import org.http4k.format.Jackson.json
 import org.http4k.lens.Query
+import org.http4k.routing.RoutingHttpHandler
 import org.http4k.routing.bind
-import java.lang.Math.max
-import java.lang.Math.min
+import kotlin.math.max
+import kotlin.math.min
 
 object WorldRoutes {
     private val jsonBody = Body.json().toLens()
@@ -30,6 +30,14 @@ object WorldRoutes {
         Response(OK).with(jsonBody of array(db.findWorlds(numberOfQueries(it))))
     }
 
+    fun cachedRoute(db: Database): RoutingHttpHandler {
+        val cachedDb = CachedDatabase(db)
+
+        return "/cached" bind GET to {
+            Response(OK).with(jsonBody of array(cachedDb.findWorlds(numberOfQueries(it))))
+        }
+    }
+
     fun updateRoute(db: Database) = "/updates" bind GET to {
         Response(OK).with(jsonBody of array(db.updateWorlds(numberOfQueries(it))))
     }

+ 2 - 8
frameworks/Kotlin/http4k/http4k-apache.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
 COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
-COPY ktornetty ktornetty
-COPY netty netty
-COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build apache:shadowJar
+RUN gradle --quiet apache:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "apache/build/libs/http4k-apache-benchmark.jar"]

+ 9 - 0
frameworks/Kotlin/http4k/http4k-apache4.dockerfile

@@ -0,0 +1,9 @@
+FROM gradle:6.6.0-jdk11
+USER root
+WORKDIR /http4k
+COPY build.gradle build.gradle
+COPY settings.gradle settings.gradle
+COPY apache4 apache4
+COPY core core
+RUN gradle --quiet apache4:shadowJar
+CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "apache4/build/libs/http4k-apache4-benchmark.jar"]

+ 9 - 0
frameworks/Kotlin/http4k/http4k-jetty.dockerfile

@@ -0,0 +1,9 @@
+FROM gradle:6.6.0-jdk11
+USER root
+WORKDIR /http4k
+COPY build.gradle build.gradle
+COPY settings.gradle settings.gradle
+COPY core core
+COPY jetty jetty
+RUN gradle --quiet jetty:shadowJar
+CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "jetty/build/libs/http4k-jetty-benchmark.jar"]

+ 2 - 8
frameworks/Kotlin/http4k/http4k-ktorcio.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
 COPY ktorcio ktorcio
-COPY ktornetty ktornetty
-COPY netty netty
-COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build ktorcio:shadowJar
+RUN gradle --quiet ktorcio:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "ktorcio/build/libs/http4k-ktorcio-benchmark.jar"]

+ 2 - 8
frameworks/Kotlin/http4k/http4k-ktornetty.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
 COPY ktornetty ktornetty
-COPY netty netty
-COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build ktornetty:shadowJar
+RUN gradle --quiet ktornetty:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "ktornetty/build/libs/http4k-ktornetty-benchmark.jar"]

+ 2 - 8
frameworks/Kotlin/http4k/http4k-netty.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
-COPY ktornetty ktornetty
 COPY netty netty
-COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build netty:shadowJar
+RUN gradle --quiet netty:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "netty/build/libs/http4k-netty-benchmark.jar"]

+ 2 - 8
frameworks/Kotlin/http4k/http4k-ratpack.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
-COPY ktornetty ktornetty
-COPY netty netty
 COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build ratpack:shadowJar
+RUN gradle --quiet ratpack:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "ratpack/build/libs/http4k-ratpack-benchmark.jar"]

+ 2 - 8
frameworks/Kotlin/http4k/http4k-undertow.dockerfile

@@ -1,15 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
-COPY ktornetty ktornetty
-COPY netty netty
-COPY ratpack ratpack
 COPY undertow undertow
-RUN gradle --quiet build undertow:shadowJar
+RUN gradle --quiet undertow:shadowJar
 CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "undertow/build/libs/http4k-undertow-benchmark.jar"]

+ 4 - 9
frameworks/Kotlin/http4k/http4k.dockerfile

@@ -1,14 +1,9 @@
-FROM gradle:5.4.1-jdk11
+FROM gradle:6.6.0-jdk11
 USER root
 WORKDIR /http4k
 COPY build.gradle build.gradle
 COPY settings.gradle settings.gradle
-COPY apache apache
 COPY core core
-COPY jetty jetty
-COPY ktorcio ktorcio
-COPY netty netty
-COPY ratpack ratpack
-COPY undertow undertow
-RUN gradle --quiet build jetty:shadowJar
-CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "jetty/build/libs/http4k-jetty-benchmark.jar"]
+COPY sunhttp sunhttp
+RUN gradle --quiet sunhttp:shadowJar
+CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "sunhttp/build/libs/http4k-sunhttp-benchmark.jar"]

+ 2 - 0
frameworks/Kotlin/http4k/settings.gradle

@@ -1,9 +1,11 @@
 rootProject.name = 'http4k-benchmark'
 include 'core'
 include 'apache'
+include 'apache4'
 include 'jetty'
 include 'ktorcio'
 include 'ktornetty'
 include 'netty'
 include 'ratpack'
+include 'sunhttp'
 include 'undertow'

+ 14 - 0
frameworks/Kotlin/http4k/sunhttp/build.gradle

@@ -0,0 +1,14 @@
+dependencies {
+    compile project(":core")
+}
+
+apply plugin: 'application'
+mainClassName = "Http4kSunHttpServerKt"
+apply plugin: 'com.github.johnrengelman.shadow'
+
+shadowJar {
+    baseName = "http4k-$project.name-benchmark"
+    classifier = null
+    version = null
+    mergeServiceFiles()
+}

+ 6 - 0
frameworks/Kotlin/http4k/sunhttp/src/main/kotlin/Http4kSunHttpServer.kt

@@ -0,0 +1,6 @@
+
+import org.http4k.server.SunHttp
+
+fun main() {
+    Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(SunHttp(9000))
+}