Greetings As developers, we often aim to deliver APIs with minimal latency, typically in just a few milliseconds. However, it's important to acknowledge that not all customer requirements are alike. There are scenarios where we must tackle intricate computations that can extend over many minutes. Let's explore solutions for addressing such use cases. Problem statement The user expects to view the outcome of a complex computation, which requires more than 5 minutes to complete. Initial design We can outline our initial architecture by offering either a REST or GraphQL API that waits for the computation to conclude. The primary limitation of this design is that it blocks the server thread, which can lead to the exhaustion of server resources. Additionally, the user remains uninformed about the ongoing process. Improving with an Async Job and Polling Rather than waiting for the calculation to complete, we can utilize a separate thread and promptly return from the initial request. ...
May all beings be happy, be well, be peaceful, and be free