Browse Source

Change JDBC pool size because of a performance problem (#6737)

* 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

* Change JDBC pool size because of a performance problem
Juanjo Aguililla 4 years ago
parent
commit
f871c86fc9

+ 2 - 2
frameworks/Kotlin/hexagon/build.gradle

@@ -1,13 +1,13 @@
 
 plugins {
-    id "org.jetbrains.kotlin.jvm" version "1.5.10"
+    id "org.jetbrains.kotlin.jvm" version "1.5.21"
 }
 
 ext {
     gradleScripts = "https://raw.githubusercontent.com/hexagonkt/hexagon/1.3.20/gradle"
 
     hexagonVersion = "1.3.20"
-    hikariVersion = "3.4.5" // TODO Check also with 5.0.0
+    hikariVersion = "4.0.3" // TODO Check with 3.4.5, 4.0.3 or 5.0.0
     jettyVersion = "10.0.6"
     postgresqlVersion = "42.2.23"
     cache2kVersion = "2.0.0.Final"

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

@@ -22,9 +22,11 @@ internal class BenchmarkSqlStore(engine: String, private val settings: Settings
 
     private val dataSource: HikariDataSource by lazy {
         val dbHost = Jvm.systemSetting("${engine.uppercase()}_DB_HOST") ?: "localhost"
+        val environment = Jvm.systemSetting(String::class, "BENCHMARK_ENV")?.lowercase()
+        val poolSize = 8 + if (environment == "citrine") Jvm.cpuCount else Jvm.cpuCount * 2
         val config = HikariConfig().apply {
             jdbcUrl = "jdbc:postgresql://$dbHost/${settings.databaseName}"
-            maximumPoolSize = Jvm.systemSetting(Int::class, "maximumPoolSize") ?: 64
+            maximumPoolSize = Jvm.systemSetting(Int::class, "maximumPoolSize") ?: poolSize
             username = Jvm.systemSetting("databaseUsername") ?: "benchmarkdbuser"
             password = Jvm.systemSetting("databasePassword") ?: "benchmarkdbpass"
         }