Hi, I believe this is Kotlin related as I have an ...
# spring
k
Hi, I believe this is Kotlin related as I have an issue with coroutines. Recently I've joined a project where Project Reactor is used with some light use of Coroutines and both approaches use scheduler with this config:
Copy code
Schedulers.fromExecutor(Executors.newFixedThreadPool(75))
My problem is that when I rewrote this:
Copy code
@GetMapping("/get-stuff")
fun getStuff(
    @RequestParam param: String
): Mono<ResponseObject> = Mono.fromCallable {
    service.getStuff(param = param)
}.subscribeOn(blockingScheduler)
to use coroutines:
Copy code
@GetMapping("/get-stuff")
suspend fun getStuff(
    @RequestParam param: String
): ResponseObject = withContext(blockingScheduler.asCoroutineDispatcher()) {
    service.getStuff(param = param)
}
the memory usage has increased almost 2-3 times. Do you have any idea why the performance might so much worse? That's something I definitely did not expect. Edit: I forgot to mention - the behaviour was the same when we tried to use
<http://Dispatchers.IO|Dispatchers.IO>
instead of the scheduler