7

I am using NEST to perform queries towards an Elasticsearch 6-cluster. The Elasticsearch cluster consists of a couple of nodes, but it's running behind a firewall/loadbalancer so from the client perspective it appears as a single node with a single host name.

When new versions of my application are deployed, there are short network interruptions due to how the infrastructure/network works when it comes to blue-green deployments.

Since I only have a single Elasticsearch URI, NEST will use a SingleNodeConnectionPool instance when I create the connection. I have read in the documentation 2 that with when this is the case, NEST won't perform any retries.

But in my case, I want to perform retries to handle the above network interruptions, since it's currently causes errors to be propagated to end-users. I understand i could implement retry logic myself, but I was wondering if there's some way to get retry logic for network connection errors even when using SingleNodeConnectionPool.

The error I'm getting in my code is:

System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond :

Nitramk
  • 1,542
  • 6
  • 25
  • 42
  • You can use, a Load balancer after firewall and then distribute load – Muhammad Zubair Saleem Sep 21 '21 at 12:25
  • As I wrote in my post we already use a load balancer. The connectivity issue is between my application and the firewall - not between the firewall and Elasticsearch. – Nitramk Sep 21 '21 at 13:05
  • See if you can find anything here: https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.x/retries.html. If not, I would suggest implementing retry yourself, since, with that, the control will be in your hand. – ms_27 Sep 27 '21 at 16:45
  • _When new versions of my application are deployed, there are short network interruptions due to how the infrastructure/network works when it comes to blue-green deployments._ tell us more... Is the ES cluster being redeployed too? Why are you having the network issue at all? – Leo Sep 30 '21 at 08:26
  • The ES cluster is not being redeployed to. The network interruptions between the application and ES are occurring intermittently partly due to how the underlying cloud infrastructure works when it comes to deploying new versions. That is besides the point though - the first fallacy of distributed computing is "The network is reliable". Elasticsearch retries on network interruptions when you have >1 nodes, I just wonder how to perform retries on network interruptions when you have 1 node. – Nitramk Oct 01 '21 at 05:19
  • did you try [Transports](https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.x/transports.html) or [Request pipelines](https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.x/request-pipelines.html)? – David Oct 02 '21 at 11:37

0 Answers0