-
-
Notifications
You must be signed in to change notification settings - Fork 60
feat(cbrs): load based routing strategy #7519
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
base: master
Are you sure you want to change the base?
Conversation
| class LoadBasedRoutingStrategy(OutcomesBasedRoutingStrategy): | ||
| """ | ||
| If cluster load is under a threshold, ignore recommendations and allow the query to pass through with the tier decided based on outcomes-based routing. | ||
| """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this inheriting from OutcomesBasedRoutingStrategy? shouldn't it inherit BaseRoutingStrategy?
I think it's mixing concerns weirdly to make the load-based routing in any way aware or coupled to outcomes-based routing. Some third entity/module should chain the two together if that's necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally the intention was to tightly couple load-based routing strategy with outcomes-based, but now thinking about it, it makes sense to separate the two, especially if in the future we want to use a different strategy to decide which tier. I used a new strategy to chain the two together
| def _update_routing_decision(self, routing_decision: RoutingDecision) -> None: | ||
| OutcomesBasedRoutingStrategy()._update_routing_decision(routing_decision) | ||
| LoadBasedRoutingStrategy()._update_routing_decision(routing_decision) |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| if load_info is None: | ||
| return | ||
|
|
||
| pass_through_threshold = int(self.get_config_value("pass_through_load_percentage")) | ||
| pass_through_max_threads = int(self.get_config_value("pass_through_max_threads")) | ||
|
|
||
| if load_info.cluster_load < pass_through_threshold: |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| def __init__(self) -> None: | ||
| self._outcomes_based_routing_strategy = OutcomesBasedRoutingStrategy() | ||
| self._load_based_routing_strategy = LoadBasedRoutingStrategy() |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
| routing_decision: RoutingDecision, | ||
| ) -> None: | ||
| load_info = routing_decision.routing_context.cluster_load_info | ||
| if load_info is None or load_info.cluster_load < 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means something in load retriever went wrong, in which case this would be as if only outcomes based routing strategy ran, which effectively means everything works the same as before
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Basically does what
OutcomesBasedRoutingStrategydoes except when cluster load is low enough, we let the query through even if allocation policies say noRollout plan:
storage_routing_config_override={'{"1": {"version": 1, "config": {"LoadBasedOutcomesRoutingStrategy": 1.0}}}',default_storage_routing_config= '{"version": 1, "config": {"LoadBasedOutcomesRoutingStrategy": 0.5, "OutcomesBasedRoutingStrategy": 0.5}}'merging this PR does not automatically make any queries go through this routing strategy, I have to set the routing config in Snuba Admin