Skip to content

Commit 848d684

Browse files
authored
initial commit of vertx-web-kotlin-dsljson benchmark (#9172)
* initial commit of vertx-web-kotlin-dsljson benchmark * removed dagger. improved query performance.
1 parent dbaaefa commit 848d684

37 files changed

+1683
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Vert.x-Web Kotlin Dsljson Benchmarking Test
2+
3+
Vert.x-Web in Kotlin with Dsljson serialization
4+
5+
The code is written as a realistic server implementation:
6+
- Code is organized logically into packages
7+
- Repositories are created for each database entity to handler all operations pertaining to a specific table
8+
- Handlers map to the logical entities which they serve
9+
- JSON serialization is provided via Dsljson
10+
- Doing this effectively required a custom Vert.x Buffer implementation that also extended OutputStream in order to rely on the efficient Vert.x heap memory pool instead of building a novel implementation.
11+
12+
## Test URLs
13+
14+
### JSON
15+
16+
http://localhost:8080/json
17+
18+
### PLAINTEXT
19+
20+
http://localhost:8080/plaintext
21+
22+
### DB
23+
24+
http://localhost:8080/db
25+
26+
### QUERY
27+
28+
http://localhost:8080/query?queries=
29+
30+
### UPDATE
31+
32+
http://localhost:8080/update?queries=
33+
34+
### FORTUNES
35+
36+
http://localhost:8080/fortunes
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"framework": "vertx-web-kotlin-dsljson",
3+
"tests": [
4+
{
5+
"default": {
6+
"json_url": "/json",
7+
"plaintext_url": "/plaintext",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Micro",
11+
"database": "None",
12+
"framework": "vertx-web",
13+
"language": "Kotlin",
14+
"flavor": "None",
15+
"orm": "Raw",
16+
"platform": "Vert.x",
17+
"webserver": "None",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "vertx-web-kotlin-dsljson",
21+
"notes": "",
22+
"versus": "vertx-web"
23+
},
24+
"postgresql": {
25+
"db_url": "/db",
26+
"query_url": "/queries?queries=",
27+
"fortune_url": "/fortunes",
28+
"update_url": "/updates?queries=",
29+
"port": 8080,
30+
"approach": "Realistic",
31+
"classification": "Micro",
32+
"database": "postgres",
33+
"framework": "vertx-web",
34+
"language": "Kotlin",
35+
"flavor": "None",
36+
"orm": "Raw",
37+
"platform": "Vert.x",
38+
"webserver": "None",
39+
"os": "Linux",
40+
"database_os": "Linux",
41+
"display_name": "vertx-web-kotlin-dsljson-postgresql",
42+
"notes": "",
43+
"versus": "vertx-web-postgres"
44+
}
45+
}
46+
]
47+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
4+
plugins {
5+
kotlin("jvm") version "1.9.22"
6+
kotlin("kapt") version "1.9.22"
7+
application
8+
id("com.github.johnrengelman.shadow") version "7.1.2"
9+
}
10+
11+
group = "com.example"
12+
version = "1.0.0-SNAPSHOT"
13+
14+
repositories {
15+
mavenCentral()
16+
}
17+
18+
java {
19+
toolchain {
20+
languageVersion.set(JavaLanguageVersion.of(21))
21+
}
22+
}
23+
24+
kotlin {
25+
compilerOptions {
26+
jvmTarget = JvmTarget.JVM_21
27+
}
28+
jvmToolchain(21)
29+
}
30+
31+
val mainClassName = "com.example.starter.App"
32+
33+
val vertxVersion = "4.5.9"
34+
val nettyVersion = "4.1.112.Final"
35+
val scramVersion = "2.1"
36+
val dslJsonVersion = "2.0.2"
37+
val htmlFlowVersion = "4.6"
38+
val log4jVersion = "2.23.1"
39+
40+
application {
41+
mainClass = mainClassName
42+
}
43+
44+
dependencies {
45+
listOfNotNull(
46+
// Kotlin
47+
kotlin("stdlib-jdk8"),
48+
kotlin("reflect"),
49+
50+
// Vertx
51+
platform("io.vertx:vertx-stack-depchain:$vertxVersion"),
52+
"io.vertx:vertx-core",
53+
"io.vertx:vertx-web",
54+
"io.vertx:vertx-pg-client",
55+
"io.vertx:vertx-lang-kotlin",
56+
"io.vertx:vertx-lang-kotlin-coroutines",
57+
58+
// Netty
59+
"io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64",
60+
61+
// Postgres
62+
"com.ongres.scram:client:$scramVersion",
63+
64+
// dsljson
65+
"com.dslplatform:dsl-json:$dslJsonVersion",
66+
67+
// HtmlFlow
68+
"com.github.xmlet:htmlflow:$htmlFlowVersion",
69+
70+
// Logging
71+
"org.apache.logging.log4j:log4j-core:$log4jVersion",
72+
"org.apache.logging.log4j:log4j-api:$log4jVersion",
73+
"org.apache.logging.log4j:log4j-api-kotlin:1.4.0",
74+
"com.lmax:disruptor:4.0.0",
75+
).map { implementation(it) }
76+
77+
listOf(
78+
"com.dslplatform:dsl-json:$dslJsonVersion",
79+
"org.apache.logging.log4j:log4j-core:$log4jVersion",
80+
).map { kapt(it) }
81+
}
82+
83+
tasks.withType<ShadowJar> {
84+
archiveClassifier = "fat"
85+
mergeServiceFiles()
86+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
NUM_PROCESSORS=$((`grep --count ^processor /proc/cpuinfo`))
4+
5+
JVM_OPTS="-server \
6+
-Xms2G \
7+
-Xmx2G \
8+
-XX:+UseParallelGC \
9+
-XX:InitialCodeCacheSize=512m \
10+
-XX:ReservedCodeCacheSize=512m \
11+
-XX:MaxInlineLevel=20 \
12+
-XX:+AlwaysPreTouch \
13+
-XX:+UseNUMA \
14+
-Dvertx.disableMetrics=true \
15+
-Dvertx.disableH2c=true \
16+
-Dvertx.disableWebsockets=true \
17+
-Dvertx.flashPolicyHandler=false \
18+
-Dvertx.threadChecks=false \
19+
-Dvertx.disableContextTimings=true \
20+
-Dvertx.disableTCCL=true \
21+
-Dvertx.disableHttpHeadersValidation=true \
22+
-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector \
23+
-Dio.netty.buffer.checkBounds=false \
24+
-Dio.netty.buffer.checkAccessible=false \
25+
-Dtfb.hasDB=false"
26+
27+
JAR_PATH="./build/libs/vertx-web-kotlin-dsljson-benchmark-1.0.0-SNAPSHOT-fat.jar"
28+
29+
VERTX_ARGS="-instances 1"
30+
31+
cleanup() {
32+
echo "Caught SIGINT signal. Stopping the Java program..."
33+
if [ ! -z "$JAVA_PID" ]; then
34+
kill -SIGTERM "$JAVA_PID"
35+
wait "$JAVA_PID"
36+
fi
37+
exit 0
38+
}
39+
40+
trap cleanup SIGINT
41+
42+
java $JVM_OPTS -jar $JAR_PATH $VERTX_ARGS &
43+
JAVA_PID=$!
44+
45+
echo "Server PID: $JAVA_PID"
46+
47+
wait "$JAVA_PID"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.parallel=true
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)