I have a request that requires my server to establish like 3 external requests before it returns to the user. This makes this request takes like 0.8s to execute per user. What tips should one follow to optimize it so that the server can handle several requests per second? I use Apache+PHP+MySQL. Currently, on AWS micro machine, I can't handle even 5 requests per second!
Much of your waiting I expect is spent actually blocked whilst responses come through. Doing this serially is not ideal.
You should parallelize. You can use
This doesn't fix a underlying issue -- the remote datastores response speed is out of your control. But, then again you should be caching some of this content (you can use