asynchttpclient

Async Http Client what is the difference between readTimeout and requestTimeout


I'm trying to understand the difference between:

setRequestTimeout - Set the maximum time in millisecond an AsyncHttpClient waits until the response is completed.

setReadTimeout - Set the maximum time in millisecond an AsyncHttpClient can stay idle.

When should I use one versus the other?

And how do they relate to a good old java.net.SocketTimeoutException: Read timed out?


Solution

  • Request timeout = maximum duration for completing a request from the user's perspective. It can account for the time to resolve the hostname, to open the TCP connection, to perform TLS handshake, to write the request and receive the complete response.

    Read timeout = maximum time between consecutive reads. Typically used to crash when a large download is no longer making any progress.