That's not what you asked. You asked how to measure the response time of REST API calls. I told you how to measure the response time.
It sounds like you are using a blocking call to AsyncHttp. Your controller is making a call and waiting for the result. If you make a blocking call and the server doesn't respond quickly enough, of course your page request is going to time-out.
Don't use a blocking call. Use callbacks.
I wish the docs would not encourage people to make blocking calls to AsyncHttp in controllers. It is a naive approach that is never going to make users happy.