Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: prevent gateway from always being picked
Previously, the instance resoler would always assign the partition span to the gateway if the gateway was in the set of eligible instances and we did not find an eligible instance with a better locality match. In large clusters during backup/cdc running with execution locality, this could cause the gateway to get the lions share of work thereby causing it to OOM or severely throttle performance. This change make span partitioning a little more stateful. Concretely, we now track how many partition spans have been assigned to each node in the `planCtx` that is used throughout the planning of a single statement. This distribution is then used to limit the number of partition spans we default to the gateway. Currently, by default we allow the gateway to have: `2 * average number of partition spans across the other instances` If the gateway does not satisfy this heuristic we randomly pick one of the other eligible instances. Note, if there are no eligible instances except for the gateway, or the gateway has received no spans yet, we will pick the gateway. This change also adds a new session variable `distsql_plan_gateway_bias` to control how many times the gateway will be picked as the default target for a partition relative to the distribution of partition spans across other nodes. Fixes: #114079 Release note (bug fix): fixes a bug where large jobs running with execution locality could result in the gateway being assigned most of the work causing performance degradation and cluster instability
- Loading branch information
1 parent
ca4b6b0
commit 4d7aa01
Showing
9 changed files
with
558 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.