Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Implement SniffingConnectionPool #57

Closed
russcam opened this issue Jan 30, 2020 · 3 comments · Fixed by #189
Closed

[ENHANCEMENT] Implement SniffingConnectionPool #57

russcam opened this issue Jan 30, 2020 · 3 comments · Fixed by #189
Labels
enhancement New feature or request

Comments

@russcam
Copy link
Contributor

russcam commented Jan 30, 2020

Is your feature request related to a problem? Please describe.
The client can work against an Elasticsearch cluster behind a single endpoint e.g. a single node cluster, a cluster behind a proxy/load balancer. It is also useful however to be able to seed a client with a collection of endpoints, where each endpoint connects to an Elasticsearch node. In doing so, it allows for future features such as retries/failover, executing requests on a node matching a predicate e.g. data nodes only, etc. Since Elasticsearch clusters can change in size, the client should be able to reseed itsefl with the nodes (endpoints) available within the cluster. This is commonly referred to across the other Elasticsearch clients as sniffing.

Describe the solution you'd like
A SniffingConnectionPool that implements ConnectionPool that can

  1. be seeded with an initial collection of Url
  2. returns the next Connection from the pool when next() is called. In the initial implementation, this can simply iterate over connections, but in future, can mark connections dead/alive, weight them by aliveness, etc. to determine the next connection to return
  3. can periodically reseed the connections by sniffing the cluster

Additional context

An example implementation of SniffingConnectionPool from the .NET client and the behaviour

@russcam russcam added the enhancement New feature or request label Jan 30, 2020
@srleyva
Copy link
Contributor

srleyva commented Sep 12, 2020

I’ve been implementing this locally over the elasticsearch vended primitives. Still a little newer to rust but mind if I take a shot at this issue?

@russcam
Copy link
Contributor Author

russcam commented Sep 14, 2020

@srleyva please do! Please also reach out if you would like input on implementation considerations.

@srleyva
Copy link
Contributor

srleyva commented Sep 14, 2020

Similar to the .Net client, I’ve implemented a static node list connection pool as a building block. I’ve noticed a common pattern of building on top of this and refreshing the connections. Lmk if this is sound! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants