Hi there, I’m using `Exposed` to connect to a MySQ...
# exposed
d
Hi there, I’m using
Exposed
to connect to a MySQL database. As stated in the documentation,
suspendTransaction
is designed to offload blocking jobs. However, during load testing, I found that
newSuspendedTransaction
is significantly slower than
transaction
. Am I missing something? Here’s the source I’m referring to: https://ktor.io/docs/server-integrate-database.html route
Copy code
get<TestBlockingRoute> {
    call.respond(UserLetterController().getOkWordsNotSuspend())
}
get<TestNonBlockingRoute> {
    call.respond(UserLetterController().getOkWordsSuspend())
}
Copy code
fun getOkWordsNotSuspend(): List<OkWordEntity> {
    val okWords = transaction(UserDbReplicaDatabaseConnection.db) {
        okWordRepository.get()
    }
    return okWords
}

suspend fun getOkWordsSuspend(): List<OkWordEntity> {
    val okWords = UserDbReplicaDatabaseConnection.suspendTransaction {
        okWordRepository.get()
    }
    return okWords
}