Hello. Maybe do you have some insights of my problem? I have a backend with many cores, C10k traffic, and DB. DB is the slowest part. Of course, I am using a Ktor. Question, which DB driver performs better (assume server hits 100% load):
- sync driver.
- async + coroutines. A thread is able to process another request while a DB query is working.
I did some benchmarks on the artificial system and found, the sync driver was able to produce ~10% more reqs/sec. Also, the async driver takes much more memory on the same load. I assume coroutines have some overhead. I even tried to limit IO bandwidth inside docker to emulate IO cap. The sync driver was faster. However, I am not sure my benchmark was good.
So, my question, why I should use async + coroutines? Maybe do you have some insights from real-world applications?