Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch: 2.11.1
opensearch-java: 2.8.1
Apache Http Client5 Transport
Describe the issue:
I am trying to understand various underlying Apache HttpClient 5 configs that can be used when setting up OpenSearch Java client, which uses Apache HttpClient 5. There are bunch of config provided by Apache HttpClient5 to modify how you use the client. But, these seems to be the most important: RequestConfig
, and CloseableHttpAsyncClient
, which includes IOReactorConfig
and PoolingAsyncClientConnectionManager
, which then includes ConnectionConfig
. Here is the hierarchy of how I list them and what I think they mean based on the information I have found:
1. RequestConfig: Configure the request made by the http client.
- setConnectionRequestTimeout(Timeout): Timeout for the request made by the http client to get a connection from the connection pool.
- setConnectTimeout(Timeout): Timeout for the request made by the http client to get a connection from the host.
- setResponseTimeout(Timeout): Timeout for the request made by the http client to get a response from the host.
- setConnectionKeepAlive(TimeValue): Timeout for the active connection to the host when not set via Keep-Alive response header.
2. CloseableHttpAsyncClient: Configure the http client.
- evictIdleConnections(TimeValue): Evict idle connections from the connection pool after the set time.
- evictExpiredConnections(): If set to true, evict expired connections from the connection pool after some time.
- setIOReactorConfig(IOReactorConfig): Configure the I/O Reactor that manages I/O requests made by the http client.
- setSoTimeout(Timeout): Socket timeout for I/O requests made by the http client. Or maximum time for a blocked operation to finish its operation before throwing SocketTimeoutException.
- setSoKeepAlive(boolean): Something will send requests to detect broken or idle connections.
- setIoThreadCount(int): Number of threads used by the I/O Reactor.
- setSelectInterval(TimeValue): Time interval when I/O Reactor checks for socket timeout or some session requests.
- setConnectionManager(PoolingAsyncClientConnectionManager): Connection Manager that manages the connection pool used by the http client.
- setMaxConnTotal(int): Maximum threads in the connection pool.
- setDefaultConnectionConfig(ConnectionConfig): Connection Manager additional configuration.
- setConnectTimeout(Timeout): No idea what this is. This might be similar to either RequestConfig setConnectionRequestTimeout() or setConnectTimeout(), or might be different all together.
- setValidateAfterInactivity(TimeValue): Time period after which the active connections to the host needs to be validated if they are broken or stale.
- setSocketTimeout(Timeout): No idea what this is. This might be similar to IOReactorConfig setSoTimeout(), or might be completely different.
- setTimeToLive(TimeValue): TTL for a connection in the connection pool.
I am not sure how are these related or different from each other. Can anyone provide an explanation if my understanding of them are incorrect or how they are related, and how I can use them in my services that interacts with the OpenSearch cluster in production? Thank you!