This is a conceptual question about whether my specific use-case warrants the use of an asynchronous API.
Language: Python 3.11 Framework: FastAPI (ASGI)
I believe I am confused about what an asynchronous API really means, differentiated from asynchronous processing (multi-threading, event-loops, futures).
I am under the impression that the strength of an asynchronous API is that it can handle multiple requests at once, leading to less request timeouts.
Because we wanted to avoid request timeouts, I was asked to make a certain API asynchronous. This API only had 1 job to do once a day, but the computations took around 1 hour to complete. By the time the computation was done, the service awaiting for our response would've timed out...
The understanding on our part was that the app will:
- Receive request
- Immediately respond with 202 Accepted (so that the request is not timedout)
- Process request after responding
- Send the result
Is this correct or an absolutely erroneous understanding of what/how asynchronous APIs operate?
In our use case does it even make sense to worry about asynchronicity?