SocketTimeoutException while retrieving or inserting data into Elastic Search by using Rest High Level Client

后端 未结 1 1596
悲哀的现实
悲哀的现实 2021-01-05 07:44

I\'m facing SocketTimeoutException while retrieving/inserting data from/to elastic. This is happening when there are around 10-30 request/second. T

1条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-05 08:08

    We've had the same issue and after quite some digging I found the root cause: a config mismatch of the firewall between the client and the elastic servers kernel config for tcp keep alive.

    The firewall drops idle connections after 3600 seconds. The problem was that the kernel parameter for the tcp keep alive was set to 7200 seconds (default in RedHat 6.x/7.x):

    sysctl -n net.ipv4.tcp_keepalive_time
    7200
    

    So the connections are dropped before a keep alive probe is being sent. The asyncHttpClient in the elastic http client doesn't seem to handle dropped connections very well, it just waits until the socket timeout.

    So check whether you have any network device (Loadbalancer, Firewall, Proxy etc.) between your client and server which has a session timeout or similar and either increase that timeout or lower the tcp_keep_alive kernel parameter.

    0 讨论(0)
提交回复
热议问题