Skip to content
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

kvserver: add cpu time rebalancing #91674

Closed
wants to merge 3 commits into from

Conversation

kvoli
Copy link
Collaborator

@kvoli kvoli commented Nov 10, 2022

This patch introduces the necessary components to switch to cpu time rebalancing.

cpu time accounting

  • Partial accounting for the time spent on processing requests, for a specific replica. The time spent is recorded in ReplicaStats and allows for observing the aggregate cpu time spent on replicas via an exported metric rebalancing.cpunanospersecond.

instrument optional cpu balancing

  • Introduce new cluster setting to swap between which load dimension is balanced. kv.allocator.load_based_rebalancing_dimension. The available options are qps and cpu, where qps is the default
    setting.
  • Introduce a new cluster setting to control the aggressiveness of cpu rebalancing: kv.allocator.cpu_rebalance_threshold This setting defaults to 0.1, 10% aceptable difference from the mean as a target.

kvoli added 3 commits November 9, 2022 14:55
Previously, disparate types were used when comparing `StoreCapacity`,
`XThreshold` and `RangeUsageInfo`. This patch introduces a uniform
intermediate type `Load`, which is used to perform arithmetic and
comparison between types representing load.

The purpose of this change is to decouple changes to the underlying
inputs in these components to enable modifying existing load dimensions
and adding new ones with less code modification.

Additionally, `RangeUsageInfo` is uniformly passed around in place of
any specific calls to the underlying accounting `ReplicaStats`, to a
tight dependency.

Part of cockroachdb#91152

Release note: None
This patch adds partial accounting for the time spent on processing
requests, for a specific replica. The time spent is recorded in
`ReplicaStats` and allows for observing the aggregate cpu time spent on
replicas via an exported metric `rebalancing.cpunanospersecond`.

Release note: None
This patch introduces the necessary components to switch to cpu time
rebalancing.

Similarly to existing queries-per-second, this patch introduces a new
cluster setting to control the aggressiveness of cpu rebalancing:

`kv.allocator.cpu_rebalance_threshold`

This setting defaults to 0.1,  10% aceptable difference from the mean as
a target.

Another setting is utilized to swap between which load dimension is
balanced.

`kv.allocator.load_based_rebalancing_dimension`

The available options are `qps` and `cpu`, where `qps` is the default
setting.

Release note (general change): Introduced option to balance cpu time
in place of qps. This option is enabled by setting
`kv.allocator.load_based_rebalancing_dimension` to `cpu and is otherwise
set to `qps`, the previous behavior by default. The rebalance
aggressiveness may be tuned for `cpu` by setting
`kv.allocator.cpu_rebalance_threshold`, which defaults to `0.1`.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kvoli kvoli changed the title kvserver: add load dimensions kvserver: add cpu time rebalancing Nov 10, 2022
@kvoli
Copy link
Collaborator Author

kvoli commented Dec 20, 2022

superseded

@kvoli kvoli closed this Dec 20, 2022
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.

2 participants