Skip to content

Commit

Permalink
[Kotlin / Hexagon] Add asynchronous and native image benchmarks (Tech…
Browse files Browse the repository at this point in the history
…Empower#8250)

* Fix error with URLs in JEE servers

* Clean up

* Avoid classpath URLs

* Fix template loading error

* Fix template loading error

* Chores

* Fix template loading error

* Delete MongoDB DB support

Storage support in Hexagon will be moved outside the Toolkit, and so, it will be left outside the benchmark.

* Fix runtime problem

* Update Hexagon version

* Make Jackson Blackbird module optional

* Add variation with Blackbird module enabled

* Upgrade Hexagon version

* Enable blackbird Jackson module by default

* Update dependencies

* Use Hexagon version 2.0.0-B1 (and a little cleanup)

* Use Hexagon version 2.0.0-B1 (and a little cleanup)

* Use Tomcat instead Resin to test JEE integration

* Remove unused environment variable

* Clean Tomcat dockerfile

* Minor improvements

* Minor improvements

* Update to release version

* Update to the latest Hexagon release

* Add Netty adapter test

* Remove Gradle Wrapper

* Update version

* Update version

* Minimize template

* Skip Hexagon checks in the container

* Add Netty Epoll benchmark

* Database and template improvements

* Update Hexagon version

* Update Hexagon version

* Update DB settings

* Use a single store and template engine to simplify benchmark

* Bump mysql-connector-java in /frameworks/Java/wicket

Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 8.0.27 to 8.0.28.
- [Release notes](https://github.com/mysql/mysql-connector-j/releases)
- [Changelog](https://github.com/mysql/mysql-connector-j/blob/release/8.0/CHANGES)
- [Commits](mysql/mysql-connector-j@8.0.27...8.0.28)

---
updated-dependencies:
- dependency-name: mysql:mysql-connector-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump mongodb-driver-sync from 4.2.0 to 4.2.1 in /frameworks/Java/javalin

Bumps [mongodb-driver-sync](https://github.com/mongodb/mongo-java-driver) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/mongodb/mongo-java-driver/releases)
- [Commits](mongodb/mongo-java-driver@r4.2.0...r4.2.1)

---
updated-dependencies:
- dependency-name: org.mongodb:mongodb-driver-sync
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/starlette

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/django

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/routerling

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/japronto

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/fastapi

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/uvicorn

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.2.0 to 5.4.0 in /frameworks/Python/flask

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.2.0 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump ujson from 5.1 to 5.4.0 in /frameworks/Python/aiohttp

Bumps [ujson](https://github.com/ultrajson/ultrajson) from 5.1 to 5.4.0.
- [Release notes](https://github.com/ultrajson/ultrajson/releases)
- [Commits](ultrajson/ultrajson@5.1.0...5.4.0)

---
updated-dependencies:
- dependency-name: ujson
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump rails-html-sanitizer from 1.4.2 to 1.4.3 in /frameworks/Ruby/rails

Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.2 to 1.4.3.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md)
- [Commits](rails/rails-html-sanitizer@v1.4.2...v1.4.3)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump jetty-server in /frameworks/Java/jetty

Bumps [jetty-server](https://github.com/eclipse/jetty.project) from 9.4.41.v20210516 to 10.0.10.
- [Release notes](https://github.com/eclipse/jetty.project/releases)
- [Commits](jetty/jetty.project@jetty-9.4.41.v20210516...jetty-10.0.10)

---
updated-dependencies:
- dependency-name: org.eclipse.jetty:jetty-server
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump undertow-core in /frameworks/Java/undertow

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.11.Final to 2.2.15.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](undertow-io/undertow@2.2.11.Final...2.2.15.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update versions

* Update README.md

* Bump sanic from 22.3.1 to 22.6.1 in /frameworks/Python/sanic

Bumps [sanic](https://github.com/sanic-org/sanic) from 22.3.1 to 22.6.1.
- [Release notes](https://github.com/sanic-org/sanic/releases)
- [Changelog](https://github.com/sanic-org/sanic/blob/main/CHANGELOG.rst)
- [Commits](sanic-org/sanic@v22.3.1...v22.6.1)

---
updated-dependencies:
- dependency-name: sanic
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/light-java

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/rapidoid

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/jooby

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/servlet

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/spring-webflux

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/smart-socket

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/act

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Kotlin/kooby

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/dropwizard

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.3.3 to 42.4.1 in /frameworks/Java/hserver

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.3.3 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.3.3...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.4.0 to 42.4.1 in /frameworks/Java/undertow

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.4.0 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.4.0...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump postgresql from 42.2.23 to 42.4.1 in /frameworks/Kotlin/ktor/ktor

Bumps [postgresql](https://github.com/pgjdbc/pgjdbc) from 42.2.23 to 42.4.1.
- [Release notes](https://github.com/pgjdbc/pgjdbc/releases)
- [Changelog](https://github.com/pgjdbc/pgjdbc/blob/master/CHANGELOG.md)
- [Commits](pgjdbc/pgjdbc@REL42.2.23...REL42.4.1)

---
updated-dependencies:
- dependency-name: org.postgresql:postgresql
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update dependencies

* Bump undertow-core in /frameworks/Java/light-java

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.15.Final to 2.2.19.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](undertow-io/undertow@2.2.15.Final...2.2.19.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump undertow-core in /frameworks/Java/undertow

Bumps [undertow-core](https://github.com/undertow-io/undertow) from 2.2.18.Final to 2.2.19.Final.
- [Release notes](https://github.com/undertow-io/undertow/releases)
- [Commits](undertow-io/undertow@2.2.18.Final...2.2.19.Final)

---
updated-dependencies:
- dependency-name: io.undertow:undertow-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Delete Gradle Wrapper

* Use different JSON serializer

* Restore non Hexagon files

* Update Hexagon version

* Run pipeline

* Run pipeline

* Bump axum-core from 0.2.7 to 0.2.8 in /frameworks/Rust/axum

Bumps [axum-core](https://github.com/tokio-rs/axum) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/tokio-rs/axum/releases)
- [Changelog](https://github.com/tokio-rs/axum/blob/main/CHANGELOG.md)
- [Commits](tokio-rs/axum@axum-core-v0.2.7...axum-core-v0.2.8)

---
updated-dependencies:
- dependency-name: axum-core
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Revert "Bump axum-core from 0.2.7 to 0.2.8 in /frameworks/Rust/axum"

This reverts commit 4422de8.

* Version updates, code refactor and new benchmark cases

* Version updates

* Version updates

* Version updates

* [Hexagon] Refactor and updates:

* Update Hexagon version
* Use Rocker template
* Modularize the different scenarios

* Fix connection problems

* Update Hexagon

* Update Gradle

* Update dependencies

* Update Hexagon version

* Update Gradle Wrapper

* Add async and native support

* Add async and native support

* Add async and native support

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 8, 2023
1 parent c8353b1 commit 3dbce5a
Show file tree
Hide file tree
Showing 54 changed files with 837 additions and 139 deletions.
2 changes: 2 additions & 0 deletions frameworks/Kotlin/hexagon/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

**/build/
69 changes: 69 additions & 0 deletions frameworks/Kotlin/hexagon/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,75 @@
"notes": "http://hexagonkt.com",
"versus": "netty"
},
"netty-native": {
"json_url": "/json",
"db_url": "/db",
"query_url": "/query?queries=",
"fortune_url": "/fortunes",
"update_url": "/update?queries=",
"cached_query_url": "/cached-queries?count=",
"plaintext_url": "/plaintext",
"port": 9090,
"approach": "Realistic",
"classification": "Micro",
"database": "postgres",
"framework": "Hexagon",
"language": "Kotlin",
"orm": "Raw",
"platform": "Netty",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "Hexagon Netty Native PostgreSQL",
"notes": "http://hexagonkt.com",
"versus": "netty"
},
"netty-async-pgclient": {
"json_url": "/json",
"db_url": "/db",
"query_url": "/query?queries=",
"fortune_url": "/fortunes",
"update_url": "/update?queries=",
"cached_query_url": "/cached-queries?count=",
"plaintext_url": "/plaintext",
"port": 9090,
"approach": "Realistic",
"classification": "Micro",
"database": "postgres",
"framework": "Hexagon",
"language": "Kotlin",
"orm": "Raw",
"platform": "Netty",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "Hexagon Netty Async PgClient",
"notes": "http://hexagonkt.com",
"versus": "netty"
},
"vertx-pgclient": {
"json_url": "/json",
"db_url": "/db",
"query_url": "/query?queries=",
"fortune_url": "/fortunes",
"update_url": "/update?queries=",
"cached_query_url": "/cached-queries?count=",
"plaintext_url": "/plaintext",
"port": 9090,
"approach": "Realistic",
"classification": "Micro",
"database": "postgres",
"framework": "Hexagon",
"language": "Kotlin",
"orm": "Raw",
"platform": "Vertx",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "Hexagon Vertx PgClient",
"notes": "http://hexagonkt.com",
"versus": "vertx"
},
"tomcat": {
"json_url": "/json",
"db_url": "/db",
Expand Down
19 changes: 12 additions & 7 deletions frameworks/Kotlin/hexagon/build.gradle
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@

plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.10" apply false
id "org.jetbrains.kotlin.jvm" version "1.8.21" apply false
id "org.graalvm.buildtools.native" version "0.9.22" apply false
}

version = "1.0.0"
description = "TFB benchmark"
group = "com.hexagonkt"

ext {
hexagonVersion = "2.6.6"
hexagonVersion = "3.0.0-B1"
jettyVersion = "11.0.15"
nettyVersion = "4.1.93.Final"

hikariVersion = "5.0.1"
jettyVersion = "11.0.14"
postgresqlVersion = "42.6.0"
vertxVersion = "4.4.0"
vertxVersion = "4.4.2"
cache2kVersion = "2.6.1.Final"
nettyVersion = "4.1.90.Final"

applicationClass = "com.hexagonkt.BenchmarkKt"
modules = "java.naming,java.sql,java.management"
options = "--enable-preview"
gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/$hexagonVersion/gradle"
}

defaultTasks("build")

subprojects {
version = rootProject.version

apply(from: "$gradleScripts/kotlin.gradle")
}
54 changes: 54 additions & 0 deletions frameworks/Kotlin/hexagon/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ platform = "Netty"
webserver = "None"
versus = "netty"

[netty-native]
urls.plaintext = "/plaintext"
urls.json = "/json"
urls.db = "/db"
urls.query = "/query?queries="
urls.update = "/update?queries="
urls.fortune = "/fortunes"
urls.cached_query = "/cached-queries?count="
approach = "Realistic"
classification = "Micro"
database = "postgres"
database_os = "Linux"
os = "Linux"
orm = "Raw"
platform = "Netty"
webserver = "None"
versus = "netty"

[nettyepoll]
urls.plaintext = "/plaintext"
urls.json = "/json"
Expand Down Expand Up @@ -109,6 +127,24 @@ platform = "Netty"
webserver = "None"
versus = "netty"

[nettyepoll-async-pgclient]
urls.plaintext = "/plaintext"
urls.json = "/json"
urls.db = "/db"
urls.query = "/query?queries="
urls.update = "/update?queries="
urls.fortune = "/fortunes"
urls.cached_query = "/cached-queries?count="
approach = "Realistic"
classification = "Micro"
database = "postgres"
database_os = "Linux"
os = "Linux"
orm = "Raw"
platform = "Netty"
webserver = "None"
versus = "netty"

[tomcat]
urls.plaintext = "/plaintext"
urls.json = "/json"
Expand All @@ -126,3 +162,21 @@ orm = "Raw"
platform = "Servlet"
webserver = "Tomcat"
versus = "servlet"

[vertx-pgclient]
urls.plaintext = "/plaintext"
urls.json = "/json"
urls.db = "/db"
urls.query = "/query?queries="
urls.update = "/update?queries="
urls.fortune = "/fortunes"
urls.cached_query = "/cached-queries?count="
approach = "Realistic"
classification = "Micro"
database = "postgres"
database_os = "Linux"
os = "Linux"
orm = "Raw"
platform = "Vertx"
webserver = "None"
versus = "vertx"
9 changes: 4 additions & 5 deletions frameworks/Kotlin/hexagon/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
}

dependencies {
api(project(":model"))
api("com.hexagonkt:http_server:$hexagonVersion")
api("com.hexagonkt:templates_rocker:$hexagonVersion")
api("com.hexagonkt:logging_slf4j_jul:$hexagonVersion")
Expand All @@ -13,11 +14,9 @@ dependencies {

tasks.register("minimizeTemplate") {
doLast {
[ "fortunes.pebble.html", "fortunes.rocker.html" ].forEach { t ->
File template = file("$buildDir/resources/main/$t")
List<String> lines = template.readLines().collect { it.trim() }
template.write(lines.join(""))
}
File template = file("$buildDir/resources/main/fortunes.rocker.html")
List<String> lines = template.readLines().collect { it.trim() }
template.write(lines.join(""))
}
}

Expand Down
24 changes: 12 additions & 12 deletions frameworks/Kotlin/hexagon/core/src/main/kotlin/Controller.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ 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.server.handlers.HttpServerContext
import com.hexagonkt.http.server.handlers.PathHandler
import com.hexagonkt.http.server.handlers.path
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
Expand Down Expand Up @@ -55,9 +55,9 @@ class Controller(
private fun Message.toJson(): String =
toMap().serialize(Json.raw)

private fun HttpServerContext.listFortunes(
private fun HttpContext.listFortunes(
store: BenchmarkStore, templateUrl: URL, templateAdapter: TemplatePort
): HttpServerContext {
): HttpContext {

val fortunes = store.findAllFortunes() + Fortune(0, "Additional fortune added at request time.")
val sortedFortunes = fortunes.sortedBy { it.message }
Expand All @@ -67,31 +67,31 @@ class Controller(
return ok(body, contentType = html)
}

private fun HttpServerContext.dbQuery(store: BenchmarkStore): HttpServerContext {
private fun HttpContext.dbQuery(store: BenchmarkStore): HttpContext {
val ids = listOf(randomWorld())
val worlds = store.findWorlds(ids)
val world = worlds.first().toMap()

return sendJson(world)
}

private fun HttpServerContext.getWorlds(store: BenchmarkStore): HttpServerContext {
private fun HttpContext.getWorlds(store: BenchmarkStore): HttpContext {
val worldsCount = getWorldsCount(queriesParam)
val ids = (1..worldsCount).map { randomWorld() }
val worlds = store.findWorlds(ids).map { it.toMap() }

return sendJson(worlds)
}

private fun HttpServerContext.getCachedWorlds(store: BenchmarkStore): HttpServerContext {
private fun HttpContext.getCachedWorlds(store: BenchmarkStore): HttpContext {
val worldsCount = getWorldsCount(cachedQueriesParam)
val ids = (1..worldsCount).map { randomWorld() }
val worlds = store.findCachedWorlds(ids).map { it.toMap() }

return sendJson(worlds)
}

private fun HttpServerContext.updateWorlds(store: BenchmarkStore): HttpServerContext {
private fun HttpContext.updateWorlds(store: BenchmarkStore): HttpContext {
val worldsCount = getWorldsCount(queriesParam)
val worlds = (1..worldsCount).map { World(randomWorld(), randomWorld()) }

Expand All @@ -100,11 +100,11 @@ class Controller(
return sendJson(worlds.map { it.toMap() })
}

private fun HttpServerContext.sendJson(body: Any): HttpServerContext =
private fun HttpContext.sendJson(body: Any): HttpContext =
ok(body.serialize(Json.raw), contentType = json)

private fun HttpServerContext.getWorldsCount(parameter: String): Int =
request.queryParameters[parameter]?.value?.toIntOrNull().let {
private fun HttpContext.getWorldsCount(parameter: String): Int =
request.queryParameters[parameter]?.string()?.toIntOrNull().let {
when {
it == null -> 1
it < 1 -> 1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Args= \
-H:IncludeResources=.*\\.(html|class) \
--enable-preview \
--static \
--initialize-at-build-time=org.slf4j.jul.JDK14LoggerAdapter \
--initialize-at-build-time=org.slf4j.jul.JDK14LoggerAdapter$1 \
--initialize-at-build-time=org.slf4j.LoggerFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"name": "fortunes",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "fortunes$Template",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
},
{
"name": "fortunes$PlainText",
"allPublicMethods": true,
"allDeclaredFields": true,
"allDeclaredMethods": true,
"allDeclaredConstructors": true
}
]

This file was deleted.

32 changes: 32 additions & 0 deletions frameworks/Kotlin/hexagon/core_async/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

plugins {
id("nu.studer.rocker") version("3.0.4")
}

dependencies {
api(project(":model"))
api("com.hexagonkt:http_server_async:$hexagonVersion")
api("com.hexagonkt:templates_rocker:$hexagonVersion")
api("com.hexagonkt:logging_slf4j_jul:$hexagonVersion")
api("com.hexagonkt:serialization_jackson_json:$hexagonVersion")
api("org.cache2k:cache2k-core:$cache2kVersion")
}

tasks.register("minimizeTemplate") {
doLast {
File template = file("$buildDir/resources/main/fortunes.rocker.html")
List<String> lines = template.readLines().collect { it.trim() }
template.write(lines.join(""))
}
}

jar.dependsOn("minimizeTemplate")

rocker {
configurations {
create("main") {
templateDir.set(file("src/main/resources"))
optimize.set(true)
}
}
}
Loading

0 comments on commit 3dbce5a

Please sign in to comment.