Skip to content

Commit c2e68ac

Browse files
Kotlin/http4k: Upgrade everything, add GraalVM and Loom builds (#7675)
* upgrade kotlin, gradle, http4k * upgrade libraries, replace Jackson with Argo * upgrade libraries, replace Jackson with Argo * upgrade libraries, replace Jackson with Argo * upgrade libraries, replace Jackson with Argo, introduce GraalVM * update graalvm server to contain database routes * remove cached queries from graal because it isn't supported * rename graalvm jarfile * adding in loom * build custom gradle image for Java 19 builds * rename dockerfile to be correct with the value set in the config file * rename jetty dockerfile to be correct, fix config files as well * switched port to 8080 * remove database tests for graalvm for the moment * upgrade cache2k * fixes for Cache2k API upgrades * upgrade http4k * repoint at port 9000, remove duplicate code from GraalVM * fix graalvm configuration options * added reflection config * fixing graalvm reflection * cleanup * tweak implementation of cache population on update... much more efficient! * added pbl resources and reflection config for fortune endpoint classes * readded urls for graalvm * tweak config for graalvm * Introduce multiple database drivers (PGclient and Hikari) (#1) Co-authored-by: albertlatacz <[email protected]>
1 parent 595d746 commit c2e68ac

File tree

57 files changed

+820
-199
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+820
-199
lines changed

frameworks/Kotlin/http4k/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ out
33
docker
44
.idea
55
.gradle
6+
gradle/*
7+
gradle.properties
68
/gradlew
79
/gradlew.bat
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19

frameworks/Kotlin/http4k/apache/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
dependencies {
2-
api project(":core")
3-
api "org.http4k:http4k-server-apache:$http4k_version"
2+
api(project(":core-jdbc"))
3+
api("org.http4k:http4k-server-apache:$http4k_version")
44
}
55

66
apply plugin: 'application'
77
mainClassName = "Http4kApacheServerKt"
88
apply plugin: 'com.github.johnrengelman.shadow'
99

1010
shadowJar {
11-
baseName = "http4k-$project.name-benchmark"
11+
baseName = "http4k-benchmark"
1212
classifier = null
1313
version = null
1414
mergeServiceFiles()

frameworks/Kotlin/http4k/apache/src/main/kotlin/Http4kApacheServer.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ import org.http4k.server.Http4kServer
66
import org.http4k.server.ServerConfig
77

88
fun main() {
9-
/**
10-
* we need a custom config here because of how virtual hosting is required in the TFB
11-
* environment. Normally we would just call the inbuilt ApacheServer(9000) function
12-
*/
13-
val config = TfbApacheServer(9000)
14-
Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(config)
9+
Http4kBenchmarkServer(PostgresDatabase()).start(TfbApacheServer(9000))
1510
}
1611

17-
private class TfbApacheServer(val port: Int) : ServerConfig {
12+
/**
13+
* we need a custom config here because of how virtual hosting is required in the TFB
14+
* environment. Normally we would just call the inbuilt ApacheServer(9000) function
15+
*/
16+
class TfbApacheServer(val port: Int) : ServerConfig {
1817
override fun toServer(http: HttpHandler): Http4kServer = object : Http4kServer {
1918
val handler = Http4kRequestHandler(http)
2019

frameworks/Kotlin/http4k/apache4/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
dependencies {
2-
api project(":core")
3-
api "org.http4k:http4k-server-apache4:$http4k_version"
2+
api(project(":core-jdbc"))
3+
api("org.http4k:http4k-server-apache4:$http4k_version")
44
}
55

66
apply plugin: 'application'
77
mainClassName = "Http4kApache4ServerKt"
88
apply plugin: 'com.github.johnrengelman.shadow'
99

1010
shadowJar {
11-
baseName = "http4k-$project.name-benchmark"
11+
baseName = "http4k-benchmark"
1212
classifier = null
1313
version = null
1414
mergeServiceFiles()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import org.http4k.server.Apache4Server
22

33
fun main() {
4-
Http4kBenchmarkServer(PostgresDatabase("tfb-database")).start(Apache4Server(9000))
4+
Http4kBenchmarkServer(PostgresDatabase()).start(Apache4Server(9000))
55
}

frameworks/Kotlin/http4k/benchmark_config.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,28 @@
6969
"notes": "https://http4k.org",
7070
"versus": "servlet"
7171
},
72+
"graalvm": {
73+
"orm": "Raw",
74+
"database_os": "Linux",
75+
"cached_query_url": "/cached?queries=",
76+
"db_url": "/db",
77+
"fortune_url": "/fortunes",
78+
"query_url": "/queries?queries=",
79+
"update_url": "/updates?queries=",
80+
"database": "Postgres",
81+
"json_url": "/json",
82+
"plaintext_url": "/plaintext",
83+
"port": 9000,
84+
"approach": "Realistic",
85+
"classification": "Micro",
86+
"framework": "http4k",
87+
"language": "Kotlin",
88+
"platform": "graalvm",
89+
"webserver": "None",
90+
"os": "Linux",
91+
"notes": "https://http4k.org",
92+
"versus": "servlet"
93+
},
7294
"jetty": {
7395
"orm": "Raw",
7496
"database_os": "Linux",
@@ -91,6 +113,50 @@
91113
"notes": "https://http4k.org",
92114
"versus": "jetty"
93115
},
116+
"jettyloom-jdbc": {
117+
"orm": "Raw",
118+
"database_os": "Linux",
119+
"cached_query_url": "/cached?queries=",
120+
"db_url": "/db",
121+
"fortune_url": "/fortunes",
122+
"query_url": "/queries?queries=",
123+
"update_url": "/updates?queries=",
124+
"database": "Postgres",
125+
"json_url": "/json",
126+
"plaintext_url": "/plaintext",
127+
"port": 9000,
128+
"approach": "Realistic",
129+
"classification": "Micro",
130+
"framework": "http4k",
131+
"language": "Kotlin",
132+
"platform": "jetty-loom-jdbc",
133+
"webserver": "None",
134+
"os": "Linux",
135+
"notes": "https://http4k.org",
136+
"versus": "jetty"
137+
},
138+
"jettyloom-pgclient": {
139+
"orm": "Raw",
140+
"database_os": "Linux",
141+
"cached_query_url": "/cached?queries=",
142+
"db_url": "/db",
143+
"fortune_url": "/fortunes",
144+
"query_url": "/queries?queries=",
145+
"update_url": "/updates?queries=",
146+
"database": "Postgres",
147+
"json_url": "/json",
148+
"plaintext_url": "/plaintext",
149+
"port": 9000,
150+
"approach": "Realistic",
151+
"classification": "Micro",
152+
"framework": "http4k",
153+
"language": "Kotlin",
154+
"platform": "jetty-loom-pgclient",
155+
"webserver": "None",
156+
"os": "Linux",
157+
"notes": "https://http4k.org",
158+
"versus": "jetty"
159+
},
94160
"ktorcio": {
95161
"orm": "Raw",
96162
"database_os": "Linux",

frameworks/Kotlin/http4k/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
2-
ext.kotlin_version = "1.6.21"
3-
ext.http4k_version = "4.25.16.2"
2+
ext.kotlin_version = "1.7.20"
3+
ext.http4k_version = "4.33.3.0"
44

55
repositories {
66
mavenCentral()
@@ -30,7 +30,7 @@ allprojects {
3030
version = project.hasProperty('releaseVersion') ? project.releaseVersion : 'LOCAL'
3131
group = 'org.http4k'
3232

33-
compileTestKotlin.kotlinOptions.languageVersion = "1.6"
33+
compileTestKotlin.kotlinOptions.languageVersion = "1.7"
3434
}
3535

3636
dependencies {

frameworks/Kotlin/http4k/config.toml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,42 @@ platform = "jetty"
109109
webserver = "None"
110110
versus = "jetty"
111111

112+
[jettyloom-jdbc]
113+
urls.plaintext = "/plaintext"
114+
urls.json = "/json"
115+
urls.db = "/db"
116+
urls.query = "/queries?queries="
117+
urls.update = "/updates?queries="
118+
urls.fortune = "/fortunes"
119+
urls.cached_query = "/cached?queries="
120+
approach = "Realistic"
121+
classification = "Micro"
122+
database = "Postgres"
123+
database_os = "Linux"
124+
os = "Linux"
125+
orm = "Raw"
126+
platform = "jetty-loom-jdbc"
127+
webserver = "None"
128+
versus = "jetty"
129+
130+
[jettyloom-pgclient]
131+
urls.plaintext = "/plaintext"
132+
urls.json = "/json"
133+
urls.db = "/db"
134+
urls.query = "/queries?queries="
135+
urls.update = "/updates?queries="
136+
urls.fortune = "/fortunes"
137+
urls.cached_query = "/cached?queries="
138+
approach = "Realistic"
139+
classification = "Micro"
140+
database = "Postgres"
141+
database_os = "Linux"
142+
os = "Linux"
143+
orm = "Raw"
144+
platform = "jetty-loom-pgclient"
145+
webserver = "None"
146+
versus = "jetty"
147+
112148
[apache]
113149
urls.plaintext = "/plaintext"
114150
urls.json = "/json"
@@ -127,6 +163,24 @@ platform = "apache-httpcore"
127163
webserver = "None"
128164
versus = "servlet"
129165

166+
[graalvm]
167+
urls.plaintext = "/plaintext"
168+
urls.json = "/json"
169+
urls.db = "/db"
170+
urls.query = "/queries?queries="
171+
urls.update = "/updates?queries="
172+
urls.fortune = "/fortunes"
173+
urls.cached_query = "/cached?queries="
174+
approach = "Realistic"
175+
classification = "Micro"
176+
database = "Postgres"
177+
database_os = "Linux"
178+
os = "Linux"
179+
orm = "Raw"
180+
platform = "graalvm"
181+
webserver = "None"
182+
versus = "servlet"
183+
130184
[ktorcio]
131185
urls.plaintext = "/plaintext"
132186
urls.json = "/json"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
dependencies {
2+
api(project(":core"))
3+
api("com.zaxxer:HikariCP:5.0.1")
4+
api("org.postgresql:postgresql:42.5.0")
5+
}

0 commit comments

Comments
 (0)