|
@@ -6,8 +6,10 @@ import com.hexagonkt.model.CachedWorld
|
|
import com.hexagonkt.model.Fortune
|
|
import com.hexagonkt.model.Fortune
|
|
import com.hexagonkt.model.World
|
|
import com.hexagonkt.model.World
|
|
import io.vertx.core.Future
|
|
import io.vertx.core.Future
|
|
|
|
+import io.vertx.core.Vertx
|
|
|
|
+import io.vertx.core.VertxOptions
|
|
|
|
+import io.vertx.pgclient.PgBuilder
|
|
import io.vertx.pgclient.PgConnectOptions
|
|
import io.vertx.pgclient.PgConnectOptions
|
|
-import io.vertx.pgclient.PgPool
|
|
|
|
import io.vertx.sqlclient.*
|
|
import io.vertx.sqlclient.*
|
|
import org.cache2k.Cache
|
|
import org.cache2k.Cache
|
|
|
|
|
|
@@ -35,11 +37,15 @@ class BenchmarkPgClientStore(
|
|
private val poolOptions: PoolOptions by lazy {
|
|
private val poolOptions: PoolOptions by lazy {
|
|
PoolOptions().apply {
|
|
PoolOptions().apply {
|
|
val environment = Jvm.systemSettingOrNull<String>("BENCHMARK_ENV")?.lowercase()
|
|
val environment = Jvm.systemSettingOrNull<String>("BENCHMARK_ENV")?.lowercase()
|
|
- maxSize = 8 + if (environment == "citrine") Jvm.cpuCount else Jvm.cpuCount * 2
|
|
|
|
|
|
+ val poolSize = 8 + if (environment == "citrine") Jvm.cpuCount else Jvm.cpuCount * 2
|
|
|
|
+ maxSize = Jvm.systemSettingOrNull(Int::class, "maximumPoolSize") ?: poolSize
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private val dataSource: SqlClient by lazy { PgPool.client(connectOptions, poolOptions) }
|
|
|
|
|
|
+ private val dataSource: SqlClient by lazy {
|
|
|
|
+ val vertx = Vertx.vertx(VertxOptions().setPreferNativeTransport(true))
|
|
|
|
+ PgBuilder.client().using(vertx).connectingTo(connectOptions).with(poolOptions).build()
|
|
|
|
+ }
|
|
|
|
|
|
override fun findAllFortunes(): List<Fortune> =
|
|
override fun findAllFortunes(): List<Fortune> =
|
|
dataSource.preparedQuery(SELECT_ALL_FORTUNES)
|
|
dataSource.preparedQuery(SELECT_ALL_FORTUNES)
|