-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Support server selection priorities / weights #252
Comments
It'd also be useful for gradually scaling in new versions of a service. |
I could see a use-case for weights as well. We have some different hardware profiles, and I would love to be able to weight nodes accordingly since we know performance for a particular piece of software is a certain percentage worse on certain hardware. |
This could also allow failover for services where round robin isn't preferable/possible e.g failover a load balancer for a service that has stickiness |
#488 is basically this as well, but just inside a service rather than cross-datacenter. +1 for this. |
Would these priorities be static or dynamic? |
👍 Being able to send <1% of traffic to a standby as a way of exercising DR paths would be great. Also a crude mechanisms to handle different capabilities between hardware. |
Can this be done with the new "network coordinates" or the "prepared queries". I was hoping that we could add something like this to accomplish #488 |
@a86c6f7964 prepared queries can help across datacenters for sure (using pre-configured fallbacks or network coordinates, or both). Within a datacenter, many HTTP endpoints now support the |
I guess I meant, the code that was added recently would help support easily adding this feature. Sorry for the mis-communication. |
While not exactly server priorities, many on this issue have referenced automatic DC failover as a reason for wanting server priorities. As @slackpad mentioned earlier, with Prepared Queries this is possible, and has been made easier with Prepared Query Templates. We held a webinar and covered this at around minute 31. https://www.youtube.com/watch?v=FGbzS6ripXA&feature=youtu.be&t=1690 |
👍 With tag {
"Name": "remote-",
"Template": {
"Type": "name_prefix_match"
},
"Service": {
"Service": "${name.suffix}",
"Tags": ["!local"]
}
} This is actually already possible if we merge the Then if we add failover-to-query, we can do priorities: {
"Name": "local-first-",
"Template": {
"Type": "name_prefix_match"
},
"Service": {
"Service": "${name.suffix}",
"Tags": ["local"],
"Failover": {
"Query": "remote-${name.suffix}",
}
} With failover-to-query it could even finally failover to another DC if local and remote aren't available. Weights are a bit tougher, because then Consul has to keep some kind of state about how many queries for a certain lookup. I'm using ebay/Fabio (it does weighted routing with Consul tags and services) and there are a lot of other solutions out there for weighted routing. However, I think adding a single "local" tag and fallback-to-query, together with existing tag and query functionality, would require the least code changes yet still allow flexibility in composing complex queries. Tag groups could fallback to any other tag groups and nodes can be prioritized in any order. EDIT: this fallback functionality is also specifically requested in #1159 |
Why not just look up everything as a query? Sean Chittenden |
Hey, this got me wondering, when an |
@cirocosta agents send the query to a server, which may forward it to a leader depending on the consistency mode of the query. |
Adding to what @preetapan said - agents pick a random server and use that for a while, and then periodically choose a new one at a frequency that's dependent on the size of the cluster. This gives users of stale queries the best chance of having their load spread across the cluster. Since many kinds of requests have to be forwarded to the leader internally by the servers, it doesn't give much of an advantage to choose the nearest one. |
Weighting would also be useful for load based routing to a service. Say we have a service that has 3 nodes but one of those nodes gets under medium load. We'd like to prefer the other 2, but still leave that node in the service in case the others go down. |
@sean- There is also the use case mentioned above about introducing a new server in a canary style fashion, i.e. sending x% of random requests to the new server (or again in the case of load dropping the number of clients being sent to a node but still serving it). Conul wouldn't need to track connections to a node in this case, just offer a priority field that can be set for a service on a node, the randomized order from a standard service lookup could then be weighted by that priority. |
We are also need this feature. There are any plans? |
Thank you for reporting and helping with this issue/feature request! |
If we support priories, then you can in support cases like a server in a remote region (for backup / quorum purposes). The priorities would disable client routing through them unless necessary (higher priority servers have failed / are unreachable).
The text was updated successfully, but these errors were encountered: