Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/Kotlin/ktor/benchmark_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"framework": "ktor",
"maintainers": ["ShreckYe"],
"maintainers": ["ShreckYe", "inemtsev"],
"tests": [
{
"default": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ fun Application.main() {
.then(Mono.from(connection.commitTransaction()))
},
Connection::close,
{ connection, _ -> connection.rollbackTransaction() },
{ connection -> connection.rollbackTransaction() }
{ connection, _ -> Mono.from(connection.rollbackTransaction()).then(Mono.from(connection.close())) },
{ connection -> Mono.from(connection.rollbackTransaction()).then(Mono.from(connection.close())) }
).awaitFirstOrNull()

call.respondJson(updatedWorlds)
Expand All @@ -126,11 +126,14 @@ private suspend fun ConnectionFactory.fetchWorlds(
): List<World> {
if (count <= 0) return emptyList()
val concurrency = min(count, 32)
return Mono.usingWhen(create(), { connection ->
Flux.range(0, count)
.flatMap({ selectWorldPublisher(connection) }, concurrency)
.collectList()
}, Connection::close).awaitSingle()
return Flux.range(0, count)
.flatMap({
Mono.usingWhen(create(), { connection ->
selectWorldPublisher(connection)
}, Connection::close)
}, concurrency)
.collectList()
.awaitSingle()
}

private fun selectWorld(connection: Connection): Mono<World> =
Expand Down Expand Up @@ -186,7 +189,6 @@ private fun configurePostgresR2DBC(config: ApplicationConfig): ConnectionFactory
.maxSize(config.property("db.maxPoolSize").getString().toInt())
.maxIdleTime(Duration.ofSeconds(30))
.maxAcquireTime(Duration.ofSeconds(5))
.validationQuery("SELECT 1")
.build()

return ConnectionPool(cp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ db {
host = "tfb-database"
port = 5432
database = "hello_world"
initPoolSize = 512
maxPoolSize = 512
initPoolSize = 32
maxPoolSize = 256
username = "benchmarkdbuser"
password = "benchmarkdbpass"
//url = "r2dbc:postgresql://"${db.host}":"${db.port}"/"${db.database}"?loggerLevel=OFF&disableColumnSanitiser=true&assumeMinServerVersion=16&sslmode=disable&maxSize="${db.poolSize}
Expand Down
Loading