소스 검색

Upgrading framework benchmark (#5932)

* Update Hexagon benchmark

* Update Hexagon benchmark

* Remove features not used in tests

* Remove MySql storage

* Enable Resin test

* Upgrade Hexagon to v0.11

* Disable Resin

* Fix dependencies

* Improve template rendering

* Test in travis

* Fix build script

* Restore Travis script

* Restore Travis script

* MySQL store support and MongoDB fix

* Fix MySQL test

* Fix MySQL test

* Fix MySQL test

* Travis testing

* Fix MySQL test

* Restore Travis

* Take MySQL URL from other test

* Add PostgreSQL support

* Update version and tests

* Update version and tests

* Only test Hexagon in fork

* Fix config

* Fix config

* Update version and tests

* Remove Resin tests

* Restore Travis

* Restore Travis

* Upgrade framework version

* Reduce local tests temporarily

* Disable Resin tests

* Fix Gradle Wrapper issues

* Restore Resin tests

* Add Bintray repository

* Disable Resin backend

* Restore master's

* Upgrade framework version

* Test only Hexagon changes (temporary)

* Test Hexagon in Travis CI

* Add Undertow support

* Test only Undertow

* Restore Travis jobs

* Enable all Hexagon's variants

* Optimize benchmark

* Fix documentation

* Fix documentation

* Add Gradle Wrapper

* Move code to conform with Kotlin's coding standards

* Trace more information (only in tests)

* Add mini performance tests (to be sure everything would be fine in TFB)

* Support different template engines

* Add configuration properties

* Drop Undertow engine

* Update versions and dependencies

* Update documentation

* Ignore Gradle directories

* Update configuration

* Update benchmark

* Improve benchmark

* Improve benchmark dockerfiles

* Next Hexagon release

* Delete Gatlin simulation

* Fix url for testing

* Remove Gatling test

* Update Hexagon benchmark

* Improve data update test

* Merge Hexagon config

* Remove batch for updates benchmark

* Fix compilation problem

* Update Kotlin version

* Update dependencies and tools

* Move source files to their package directories

* Update Gradle version

* Update

* Update Hexagon version

* Update Hexagon version

* Update Hexagon version

* Disable logging

* Update versions

* Update versions

* Update Hexagon version

* Fix dockerfiles

* Fix link

* Add infrastructure to verify the benchmark before committing

These will be used only in this benchmark's development. The Dockerfiles to
generate the images won't run the tests or start testing infrastructure.

* Assure the benchmark behaves properly under light load

The tests will run only at development.

* Upgrade Hexagon and dependencies versions

* Delete unneeded settings

* Upgrade images versions

* Add missing Gradle Wrapper scripts

* Improve documentation

* Fix build problem (CURL not included in `slim` image)

* Fix pipeline

* Fix pipeline

* Add Docker images to Docker Compose to test containers

* Apply PR suggestions

* Upgrade Hexagon

* Upgrade Hexagon

* Adopt Kotlin coding conventions and YAML formatting rules

* Update versions and delete obsolete config file

* Fix application deployment

Co-authored-by: Juanjo Aguililla <[email protected]>
Co-authored-by: Juanjo Aguililla <[email protected]>
Co-authored-by: jaguililla <[email protected]>
Juanjo Aguililla 5 년 전
부모
커밋
77edc59e90

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

@@ -5,12 +5,15 @@ plugins {
 
 apply(from: "$gradleScripts/kotlin.gradle")
 apply(from: "$gradleScripts/application.gradle")
-apply(from: "$gradleScripts/junit.gradle")
 
 apply(plugin: "war")
 
 defaultTasks("installDist")
 
+application {
+    mainClassName = "com.hexagonkt.BenchmarkKt"
+}
+
 war {
     archiveFileName = "ROOT.war"
 }
@@ -25,6 +28,10 @@ dependencies {
     implementation("com.zaxxer:HikariCP:$hikariVersion")
     implementation("org.postgresql:postgresql:$postgresqlVersion")
 
+    implementation("org.slf4j:slf4j-jdk14:1.7.30")
+    runtimeOnly("org.slf4j:jcl-over-slf4j:1.7.30")
+    runtimeOnly("org.slf4j:log4j-over-slf4j:1.7.30")
+
     // providedCompile excludes the dependency only in the WAR, not in the distribution
     providedCompile("org.eclipse.jetty:jetty-webapp:$jettyVersion") { exclude module: "slf4j-api" }
 

+ 4 - 5
frameworks/Kotlin/hexagon/gradle.properties

@@ -1,10 +1,9 @@
 description=Hexagon web framework's benchmark
-gradleScripts=https\://raw.githubusercontent.com/hexagonkt/hexagon/1.2.16/gradle
-hexagonVersion=1.2.16
-hikariVersion=3.4.3
-jettyVersion=9.4.28.v20200408
+gradleScripts=https://raw.githubusercontent.com/hexagonkt/hexagon/1.2.24/gradle
+hexagonVersion=1.2.24
+hikariVersion=3.4.5
+jettyVersion=9.4.31.v20200723
 logbackVersion=1.2.3
-mainClassName=com.hexagonkt.BenchmarkKt
 name=hexagon
 postgresqlVersion=42.2.12
 testngVersion=6.14.3

+ 1 - 1
frameworks/Kotlin/hexagon/gradle/wrapper/gradle-wrapper.properties

@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip
+distributionUrl=https://services.gradle.org/distributions/gradle-6.6-all.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists

+ 2 - 2
frameworks/Kotlin/hexagon/hexagon-jetty-postgresql.dockerfile

@@ -1,7 +1,7 @@
 #
 # BUILD
 #
-FROM gradle:6.4-jdk11 AS gradle_build
+FROM gradle:6.6-jdk11 AS gradle_build
 USER root
 WORKDIR /hexagon
 
@@ -13,7 +13,7 @@ RUN gradle --quiet --exclude-task test
 #
 # RUNTIME
 #
-FROM openjdk:11.0.7-jre-buster
+FROM adoptopenjdk:11-jre-hotspot-bionic
 ENV DBSTORE postgresql
 ENV POSTGRESQL_DB_HOST tfb-database
 ENV WEBENGINE jetty

+ 3 - 4
frameworks/Kotlin/hexagon/hexagon-resin-mongodb.dockerfile

@@ -1,7 +1,7 @@
 #
 # BUILD
 #
-FROM gradle:6.4-jdk11 AS gradle_build
+FROM gradle:6.6-jdk11 AS gradle_build
 USER root
 WORKDIR /hexagon
 
@@ -13,14 +13,13 @@ RUN gradle --quiet --exclude-task test
 #
 # RUNTIME
 #
-FROM openjdk:11.0.7-jre-buster
+FROM adoptopenjdk:11-jre-hotspot-bionic
 ENV DBSTORE mongodb
 ENV MONGODB_DB_HOST tfb-database
-ENV RESIN http://caucho.com/download/resin-4.0.64.tar.gz
+ENV RESIN http://caucho.com/download/resin-4.0.65.tar.gz
 
 WORKDIR /resin
 RUN curl -sL $RESIN | tar xz --strip-components=1
 RUN rm -rf webapps/*
 COPY --from=gradle_build /hexagon/build/libs/ROOT.war webapps/ROOT.war
-COPY resin.xml conf/resin.xml
 CMD ["java", "-jar", "lib/resin.jar", "console"]

+ 3 - 4
frameworks/Kotlin/hexagon/hexagon-resin-postgresql.dockerfile

@@ -1,7 +1,7 @@
 #
 # BUILD
 #
-FROM gradle:6.4-jdk11 AS gradle_build
+FROM gradle:6.6-jdk11 AS gradle_build
 USER root
 WORKDIR /hexagon
 
@@ -13,14 +13,13 @@ RUN gradle --quiet --exclude-task test
 #
 # RUNTIME
 #
-FROM openjdk:11.0.7-jre-buster
+FROM adoptopenjdk:11-jre-hotspot-bionic
 ENV DBSTORE postgresql
 ENV POSTGRESQL_DB_HOST tfb-database
-ENV RESIN http://caucho.com/download/resin-4.0.64.tar.gz
+ENV RESIN http://caucho.com/download/resin-4.0.65.tar.gz
 
 WORKDIR /resin
 RUN curl -sL $RESIN | tar xz --strip-components=1
 RUN rm -rf webapps/*
 COPY --from=gradle_build /hexagon/build/libs/ROOT.war webapps/ROOT.war
-COPY resin.xml conf/resin.xml
 CMD ["java", "-jar", "lib/resin.jar", "console"]

+ 2 - 2
frameworks/Kotlin/hexagon/hexagon.dockerfile

@@ -1,7 +1,7 @@
 #
 # BUILD
 #
-FROM gradle:6.4-jdk11 AS gradle_build
+FROM gradle:6.6-jdk11 AS gradle_build
 USER root
 WORKDIR /hexagon
 
@@ -13,7 +13,7 @@ RUN gradle --quiet --exclude-task test
 #
 # RUNTIME
 #
-FROM openjdk:11.0.7-jre-buster
+FROM adoptopenjdk:11-jre-hotspot-bionic
 ENV DBSTORE mongodb
 ENV MONGODB_DB_HOST tfb-database
 ENV WEBENGINE jetty

+ 0 - 16
frameworks/Kotlin/hexagon/resin.xml

@@ -1,16 +0,0 @@
-<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core">
-
-  <cluster id="">
-    <resin:import path="/resin/conf/app-default.xml"/>
-
-    <log name="" level="config" path="stdout:" timestamp="[%H:%M:%S.%s] "/>
-
-    <server id="">
-      <http port="8080"/>
-    </server>
-
-    <host>
-      <web-app-deploy path="/resin/webapps" expand-preserve-fileset="WEB-INF/work/**"/>
-    </host>
-  </cluster>
-</resin>

+ 0 - 0
frameworks/Kotlin/hexagon/src/main/kotlin/com/hexagonkt/Benchmark.kt → frameworks/Kotlin/hexagon/src/main/kotlin/Benchmark.kt


+ 2 - 2
frameworks/Kotlin/hexagon/src/main/kotlin/com/hexagonkt/BenchmarkStorage.kt → frameworks/Kotlin/hexagon/src/main/kotlin/BenchmarkStorage.kt

@@ -1,6 +1,6 @@
 package com.hexagonkt
 
-import com.hexagonkt.helpers.error
+import com.hexagonkt.helpers.fail
 import com.hexagonkt.helpers.Jvm.systemSetting
 import com.hexagonkt.settings.SettingsManager.defaultSetting
 import com.hexagonkt.store.mongodb.MongoDbStore
@@ -47,7 +47,7 @@ internal class BenchmarkMongoDbStore(engine: String) : BenchmarkStore {
 
     override fun replaceWorlds(count: Int): List<World> = (1..count)
         .map {
-            val world = worldRepository.findOne(randomWorld()) ?: error
+            val world = worldRepository.findOne(randomWorld()) ?: fail
             val worldCopy = world.copy(randomNumber = randomWorld())
             worldRepository.replaceOne(worldCopy)
             worldCopy

+ 0 - 0
frameworks/Kotlin/hexagon/src/main/resources/service.yaml → frameworks/Kotlin/hexagon/src/main/resources/application.yml


+ 0 - 18
frameworks/Kotlin/hexagon/src/main/resources/logback.xml

@@ -1,18 +0,0 @@
-<!--
- | Logback configuration for ${project.name} ${project.version}
- !-->
-<configuration>
-  <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
-
-  <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <Pattern>%d{HH:mm:ss.SSS} %highlight(%-5p) %magenta([%-18.18t]) %-30c{30} | %m%n</Pattern>
-    </encoder>
-  </appender>
-
-  <root level="off">
-    <appender-ref ref="console" />
-  </root>
-
-  <logger name="com.hexagonkt.server.Server" level="info" />
-</configuration>

+ 1 - 1
frameworks/Kotlin/hexagon/src/test/kotlin/com/hexagonkt/BenchmarkTest.kt → frameworks/Kotlin/hexagon/src/test/kotlin/BenchmarkTest.kt

@@ -86,7 +86,7 @@ abstract class BenchmarkTestBase(
         val web = Web()
 
         val webRoutes = web.serverRouter.requestHandlers
-            .map { it.route.methods.first() to it.route.path.path }
+            .map { it.route.methods.first() to it.route.path.pattern }
 
         val benchmarkRoutes = listOf(
             GET to "/plaintext",

+ 3 - 0
frameworks/Kotlin/hexagon/src/test/resources/application_test.yml

@@ -0,0 +1,3 @@
+
+bindPort: 0
+maximumPoolSize: 8

+ 0 - 20
frameworks/Kotlin/hexagon/src/test/resources/logback-test.xml

@@ -1,20 +0,0 @@
-<!--
- | Logback configuration for tests
- |
- | All output is ignored by default, to enable logs change root logger level.
- !-->
-<configuration>
-  <statusListener class="ch.qos.logback.core.status.NopStatusListener" />
-
-  <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <Pattern>%d{HH:mm:ss.SSS} %highlight(%-5p) %magenta([%-18.18t]) %-30c{30} | %m%n</Pattern>
-    </encoder>
-  </appender>
-
-  <root level="off">
-    <appender-ref ref="console" />
-  </root>
-
-  <logger name="com.hexagonkt" level="off" />
-</configuration>

+ 0 - 3
frameworks/Kotlin/hexagon/src/test/resources/service_test.yaml

@@ -1,3 +0,0 @@
-
-bindPort : 0
-maximumPoolSize : 8