Skip to content

cds: config for load balancer subsets#173

Merged
htuch merged 2 commits intoenvoyproxy:masterfrom
turbinelabs:subsetting-load-balancer-config
Sep 28, 2017
Merged

cds: config for load balancer subsets#173
htuch merged 2 commits intoenvoyproxy:masterfrom
turbinelabs:subsetting-load-balancer-config

Conversation

@zuercher
Copy link
Copy Markdown
Member

Provides a configuration point for a load balancer that can divide endpoints into subsets addressable by route metadata.

See discussion in envoyproxy/envoy#1279.

Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a few tiny nits.

api/cds.proto Outdated
// { "keys": [ "stage", "hardware_type" ] }
// ]}
// Subsets may overlap. In the case of overlapping subsets, the first
// matching subset is selected.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment on how subsets are to be used here?

api/cds.proto Outdated
// endpoint metadata and selected by route and weighted cluster metadata.
message LbSubsetConfig {
// The behavior used when no endpoint subset matches the selected route's
// metadata. The options are no_fallback, any_endpoint, or default_subset.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: vague preference to capitalize these comments to match the enum. When we auto-generate docs, it will look more consistent.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh. I was following the pattern in DnsLookupFamily. Want me to fix those up too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. A bunch of docs were copy+paste from the v1 JSON, which may have not been case sensitive. In v2, folks are going to have to use all caps for JSON/YAML/proto.

Signed-off-by: Stephan Zuercher <stephan@turbinelabs.io>
@mattklein123
Copy link
Copy Markdown
Member

@zuercher in general this seems reasonable to me, but in this case I wonder if it would be useful to see the accompanying code PR to see if the API makes sense. I'm still a little hazy on how the matching is going to happen at decent performance without using reflection.

I don't feel that strongly about it but my preference would be to see a rough draft of the code PR so that we can look at them side by side. We can keep this open and iterate on both if that works for you.

@zuercher
Copy link
Copy Markdown
Member Author

Ok.

@zuercher
Copy link
Copy Markdown
Member Author

See envoyproxy/envoy#1735 for the requested rough draft.

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending my question about LB runtime performance in the other PR. @htuch ?

Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While reading this it occurred to me that there are other choices that could be made, such as "most specific subset wins" or the like, but these may imply more overhead in the LB matching algorithm. @zuercher can you comment on the rationale here?

@htuch
Copy link
Copy Markdown
Member

htuch commented Sep 26, 2017

Also, are the subset key lists only a convenience for the purpose of precomputing subsets ahead of time?

@zuercher
Copy link
Copy Markdown
Member Author

Yes, there are choices about how to reconcile overlapping subsets that require more or less overhead. I tried to pick one that was efficient and allowed one to reason about which subset would chosen for a given input.

The subset key lists call out the combinations of metadata keys that are desired for routing. This lets you specify that you might want, for example, to route on stage+version or just version, but not on stage alone. Or as a different example, that you want to route on stage+version and memory_size+version but not other combinations.

Effectively it lets you limit the number of subsets be limiting the possible combinations and lets you ignore certain metadata altogether. (The latter could be achieved by filtering them from the config in the first place.)

Precomputing the subsets ahead of time lets you avoid whatever locking would be necessary if they were done at the point of load balancing. I think that's preferred. We could instead compute the required subsets from the current routes. Eventually, however, I'd like to see a mechanism where the metadata values used for choosing a subset come from a request header. My use case for this is to allow a developer to force their requests to a particular endpoint (e.g., a test version they've deployed) without having to explicitly add routes.

@mattklein123
Copy link
Copy Markdown
Member

Eventually, however, I'd like to see a mechanism where the metadata values used for choosing a subset come from a request header. My use case for this is to allow a developer to force their requests to a particular endpoint (e.g., a test version they've deployed) without having to explicitly add routes.

I have a lot of thoughts on cool stuff we can do here. See: envoyproxy/envoy#343 for tracking issue.

I think the decisions made here are a good balance of flexibility and runtime performance.

@htuch I'm inclined to merge. Any objections?

@htuch
Copy link
Copy Markdown
Member

htuch commented Sep 27, 2017

Yep, this is great. I think we should capture @zuercher's explanation above for posterity somewhere, I think there's been a lot of thought put into this design that won't be later obvious from just glancing at the API or the implementation details. Up to @zuercher how to do this.

@mattklein123
Copy link
Copy Markdown
Member

Yeah agreed on docs. I think MD in proxy repo is probably fine but up to @zuercher if he wants to do here.

@zuercher
Copy link
Copy Markdown
Member Author

I'll add some docs tomorrow.

@htuch
Copy link
Copy Markdown
Member

htuch commented Sep 28, 2017

OK, will merge this one for now so we can unblock work on your other PR, look forward to looking at docs.

@htuch htuch merged commit 1388a25 into envoyproxy:master Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants