# ktor

Fernando Sanchez (Perraco Labs)

03/11/2024, 8:41 AM
I am trying to understand why in a typical CRUD server I should mark the service and repository functions with suspend. As far as I understood, Ktor requests run in a Dispatcher.IO (?). If all my requests are Route - Service - Repository calls, what are the benefits in marking the service and repository functions with suspend? or using
in the repository or service layer before performing IO operations? I know this would be beneficial if I had to execute for example multiple async tasks within the same request call, but this is not the case.

Antonio Acuña Prieto

03/11/2024, 9:00 AM
Related: As far as I know, if everything is running already on IO dispatcher which is meant to execute blocking operations, there is no benefit of doing what you said because it’s already there. But… I’m only trying to understand too so…