Hello all,
this case mainly talks about "The Connection Is Interrupted Unexpectedly When Multiple Threads Concurrently Write Data to Elasticsearch"
Applicable Version
6.5.x
Context and Symptom
When multiple threads concurrently write data to Elasticsearch, the connection is interrupted and the error message "error while performing request" is displayed. After DEFAULT_CONNECTION_REQUEST_TIMEOUT_MILLIS=-1 is modified, the error message "Request cannot be executed; I/O reactor status :STOPPED." is displayed.
Cause Analysis
If the value of the DEFAULT_CONNECTION_REQUEST_TIMEOUT_MILLIS parameter in the RestClient is small, the HTTP connection pool may fail to obtain connections within the specified period.
The RestClient invokes the CloseableHttpAsyncClient to execute the request. At the beginning of the execution, the RestClient checks the status. If the status is not active, the preceding error is reported.
In the error message, the value of status is STOPPED, indicating that the RESTClient is disabled. There is a high probability that multiple threads in the service program share the RESTClient. A thread disables the RESTClient after invoking it. As a result, an error is reported when other threads send requests.
Solution
Modify the service code on the ISV to ensure that the RESTClient resource created is not released in the threads.