-
Notifications
You must be signed in to change notification settings - Fork 701
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
LoadBalancer: support hint-based instance selection #672
Comments
Hi - Our requirements is that we need to query service-instances to check if they own a specific "key" and select the one that holds the key. We're planning to create our own interceptor/filter for Now - we can probably work our way around the current Spring-Cloud LoadBalancer code, but it would be nice if we could either align with upcoming changes to the your code -- or even better, if we could contribute our code to Spring-Cloud :). So - to summarise: What's the current status on this issue? Are there any design docs or discussions that we could read up on to get an idea about what direction you're heading? |
@andersenleo would definitely be great if you could provide a PR - we have this in the backlog for 2020-1 release train (Ilford), but it might be released faster if you contribute. Let me get back to you tomorrow here with some ideas on how we planned to implement it and let's discuss it then. |
We've been thinking about the following features:
These are the ideas we've had, but it's still a good time to have a discussion about it and propose alternative design solutions, so feel free to pass your suggestions. Note: I will be working on #675 this and probably next week, so it might make sense for you to wait till that's merged, as it will require switching to the loadBalancer |
Thanks a lot for the information, @OlgaMaciaszek |
Hi @OlgaMaciaszek and thank you for the info. One significant difference is that the process of filtering as you suggest is static as it only looks at the metadata of the service instance, whereas we actually hit the services to see, according to pre-defined conditions, which one is to be chosen. Your suggested strategy of checking the service instance meta-data could be a default strategy, but we should maybe have the option of plugging in other strategies? More about that below ⬇️ As promised, here is the write-up for how we handle service instance filtering:
If you're curious the
Regarding your strategy for checking metadata on the service instances, that can be implemented with the
Furthermore we could even export the evaluation to maybe a BiPredicate in order for developers to point on different key/values and not just "loadBalancerHint", but hopefully the intention is clear in this example. We would love your thoughts on this! |
I suggest you just make and contribute changes in the I think we would like to stick with the metadata-based hint implementation for now (at least until we see more users that would like to use a dynamic one in future) and you could use the one you describe as your own custom implementation (I can implement the metadata-based one once you've contributed the changes to the exchange filter function). |
Hi @OlgaMaciaszek . Sorry for the late reply. Thank you for the input and I'll look at sending over a PR for |
I think you're right about not introducing the We'll try to iron out a PR (me and @andaziar) with the intention/scope of allowing |
Related to: #647
Possible implementation:
loadBalancerHint
header =someVal
loadBalancer.choose(serviceId, request)
, wheresomeVal
can be retrieved fromrequest.getContext()
metadataMap.get("hint").equals("someVal")
The text was updated successfully, but these errors were encountered: