Skip to content

Commit

Permalink
kvserver: add minimum cpu lb split threshold
Browse files Browse the repository at this point in the history
Previously, `kv.range_split.load_cpu_threshold` had no minimum setting
value. It is undesirable to allow users to set this setting to low as
excessive splitting may occur.

`kv.range_split.load_cpu_threshold` now has a minimum setting value of
`10ms`.

Resolves: #98107

Release note (ops change): `kv.range_split.load_cpu_threshold` now has a
minimum setting value of `10ms`.
  • Loading branch information
kvoli committed Mar 8, 2023
1 parent c0546c7 commit 903747d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/kv/kvserver/replica_split_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ var SplitByLoadCPUThreshold = settings.RegisterDurationSetting(
"kv.range_split.load_cpu_threshold",
"the CPU use per second over which, the range becomes a candidate for load based splitting",
500*time.Millisecond,
func(threshold time.Duration) error {
// We enforce a minimum because of recursive splitting that may occur if
// the threshold is set too low. There is a fixed CPU overhead for a
// replica. At the moment no split key will be produced unless there are
// more than 100 samples (batch requests) to that replica, however the
// memory overhead of tracking split keys in split/weighted_finder.go is
// noticeable and a finder is created after exceeding this threshold.
if threshold < 10*time.Millisecond {
return errors.Errorf(
"Cannot set `kv.range_split.load_cpu_threshold` less than 10ms",
)
}
return nil
},
).WithPublic()

func (obj LBRebalancingObjective) ToSplitObjective() split.SplitObjective {
Expand Down

0 comments on commit 903747d

Please sign in to comment.