ElasticsearchClient is creating too many connections

424 Views Asked by At

I'm using the ElasticsearchClient dotnet client as a TraceListener. It is working extremely well however I don't see a way to control the total number of connections. I'm getting hundreds of connection between the client and the server and they aren't expiring.

Here's the client setup:

  Uri = new Uri(this.ElasticSearchUri);
  var cc = new ConnectionConfiguration(Uri);
  cc.ThrowOnElasticsearchServerExceptions();

  this._client = new ElasticsearchClient(cc, null, null, 
    new Elasticsearch.Net.JsonNet.ElasticsearchJsonNetSerializer() );

And the bulk index call

  await Client.BulkAsync(Index, "Trace", bbo.ToArray());

The connections on the server look like this. Should the keep-alive be changing? I didn't ask for a keep-alive.

tcp6       0      0 172.18.124.94:9200      172.18.124.91:59641     ESTABLISHED keepalive (5247.84/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.91:59604     ESTABLISHED keepalive (5247.84/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.91:60160     ESTABLISHED keepalive (6034.27/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.92:54186     ESTABLISHED keepalive (6198.11/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.91:60269     ESTABLISHED keepalive (6034.27/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.92:52496     ESTABLISHED keepalive (4592.48/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.92:53365     ESTABLISHED keepalive (4920.16/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.91:60177     ESTABLISHED keepalive (6034.27/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.92:54042     ESTABLISHED keepalive (5870.43/0/0)
tcp6       0      0 172.18.124.94:9200      172.18.124.91:60142     ESTABLISHED keepalive (6034.27/0/0)
0

There are 0 best solutions below