I have a Laravel application. The application loading perfectly fine, when I only make 3-10 API per page in my controller.
Now, I start to see the latency when I start making 200 API
requests per page in my controller.
Since Laravel is MVC.
All the code in the controller need to be fully executed and finished, and then it will send all the data/variables to the view. But that is leading to a lot of latency.
I’m thinking to perform that APIs call asynchronously, but I am not sure which one is the best move,
I did a quick search, I found :
Any directions/suggestions on this will mean a lot to me, and others that faced this issue.
Explore using Queues for this. Offload any calls to the queue, await for response.
I would recommend against 200 requests per page, it seems excessive. Perhaps start with trying to get that down before rearchitecting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With