Browse Source

Downgrade HikariCP to diagnose SQL performance drop (#6715)

* Implement caching test and refactor whole Hexagon benchmark

* Ignore Gradle generated artifacts

* Fix servlet server issue

* Fix servlet server issue

* Fix servlet server issue

* Fix servlet server issue

* Clean up

* Clean up

* Fix fortunes

* Fix Resin server

* Fix Resin server

* Fix Resin server

* Delete tests

* Upgrade dependencies

* Simplify settings

* Improve router code

* Downgrade HikariCP version to check SQL performance drop

* Add note
Juanjo Aguililla 4 years ago
parent
commit
05813501bb

+ 6 - 10
frameworks/Kotlin/hexagon/build.gradle

@@ -4,15 +4,14 @@ plugins {
 }
 
 ext {
-    gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/1.3.19/gradle"
+    gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/1.3.20/gradle"
 
-    hexagonVersion = "1.3.19"
-    hikariVersion = "4.0.3"
-    jettyVersion = "10.0.5"
-    postgresqlVersion = "42.2.21"
-    testcontainersVersion = "1.15.3"
+    hexagonVersion = "1.3.20"
+    hikariVersion = "3.4.5" // TODO Check also with 5.0.0
+    jettyVersion = "10.0.6"
+    postgresqlVersion = "42.2.23"
     cache2kVersion = "2.0.0.Final"
-    jacksonBlackbirdVersion = "2.12.3"
+    jacksonBlackbirdVersion = "2.12.4"
 }
 
 apply(from: "$gradleScripts/kotlin.gradle")
@@ -46,7 +45,4 @@ dependencies {
 
     // providedCompile excludes the dependency only in the WAR, not in the distribution
     providedCompile("org.eclipse.jetty:jetty-webapp:$jettyVersion") { exclude module: "slf4j-api" }
-
-    testImplementation("com.hexagonkt:http_client_ahc:$hexagonVersion")
-    testImplementation("org.testcontainers:junit-jupiter:$testcontainersVersion")
 }

+ 3 - 3
frameworks/Kotlin/hexagon/src/main/kotlin/Controller.kt

@@ -21,10 +21,10 @@ class Controller(private val settings: Settings) {
             get("/json") { ok(Message(settings.textMessage), Json) }
 
             benchmarkStores.forEach { (storeEngine, store) ->
-                benchmarkTemplateEngines.forEach { templateKind ->
-                    val path = "/$storeEngine/${templateKind.key}/fortunes"
+                benchmarkTemplateEngines.forEach { (templateEngineId, templateEngine) ->
+                    val path = "/$storeEngine/${templateEngineId}/fortunes"
 
-                    get(path) { listFortunes(store, templateKind.key, templateKind.value) }
+                    get(path) { listFortunes(store, templateEngineId, templateEngine) }
                 }
 
                 get("/$storeEngine/db") { dbQuery(store) }

+ 7 - 7
frameworks/Kotlin/hexagon/src/main/kotlin/store/BenchmarkSqlStore.kt

@@ -20,14 +20,14 @@ internal class BenchmarkSqlStore(engine: String, private val settings: Settings
         private const val SELECT_ALL_FORTUNES = "select * from fortune"
     }
 
-    private val dbHost: String by lazy { Jvm.systemSetting("${engine.uppercase()}_DB_HOST") ?: "localhost" }
-    private val jdbcUrl: String by lazy { "jdbc:postgresql://$dbHost/${settings.databaseName}" }
     private val dataSource: HikariDataSource by lazy {
-        val config = HikariConfig()
-        config.jdbcUrl = jdbcUrl
-        config.maximumPoolSize = Jvm.systemSetting(Int::class, "maximumPoolSize") ?: 64
-        config.username = Jvm.systemSetting("databaseUsername") ?: "benchmarkdbuser"
-        config.password = Jvm.systemSetting("databasePassword") ?: "benchmarkdbpass"
+        val dbHost = Jvm.systemSetting("${engine.uppercase()}_DB_HOST") ?: "localhost"
+        val config = HikariConfig().apply {
+            jdbcUrl = "jdbc:postgresql://$dbHost/${settings.databaseName}"
+            maximumPoolSize = Jvm.systemSetting(Int::class, "maximumPoolSize") ?: 64
+            username = Jvm.systemSetting("databaseUsername") ?: "benchmarkdbuser"
+            password = Jvm.systemSetting("databasePassword") ?: "benchmarkdbpass"
+        }
         HikariDataSource(config)
     }