kubele
08/11/2023, 4:20 PMSchedulers.fromExecutor(Executors.newFixedThreadPool(75))
My problem is that when I rewrote this:
@GetMapping("/get-stuff")
fun getStuff(
@RequestParam param: String
): Mono<ResponseObject> = Mono.fromCallable {
service.getStuff(param = param)
}.subscribeOn(blockingScheduler)
to use coroutines:
@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