Hello, I want to write a web app (API) with Maru, that is going to act as a bridge to some slow web services. A request to the API would respond with a 200 right away, and call asynchronously to the slow web services.
I am new to Elixir. Which approach would you recommend for building this? Should I need a pool of workers of some sort for the slow requests? How to supervise them? How to create them and use them from the controller? Any guidance would be much appreciated.
First question, if it responds right away and calls to the slower service, do you want to throttle that if the slow service starts to get overloaded? If so then a pool of workers is perfect for this. If not then can just spawn off processes to do the slow async call.
Poolboy is a common library for pooling-made-easy, but you can always just do a supervisor with a genserver controller and a pool of workers under an adjacent 1-for-1 supervisor too.