Skip to content

cluster-drs: trigger DRS on VM power-state events and add a combined cpu+memory metric - #14043

Open
nagaboinaramgopal wants to merge 2 commits into
apache:mainfrom
nagaboinaramgopal:feature/cluster-drs-event-driven
Open

cluster-drs: trigger DRS on VM power-state events and add a combined cpu+memory metric#14043
nagaboinaramgopal wants to merge 2 commits into
apache:mainfrom
nagaboinaramgopal:feature/cluster-drs-event-driven

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

Description

Two cluster-DRS improvements.

  1. Event-driven DRS. Cluster DRS previously ran only on the periodic timer, so an imbalance created when a VM starts or stops was not corrected until the next scheduled run. This subscribes the DRS service to VM power-state events and triggers a DRS pass for the affected cluster when one fires. Two new cluster-scoped settings control it: drs.event.driven.enable (default false, off) and drs.event.driven.interval (default 5, the minimum seconds between event-driven runs, so a burst of power events is debounced into a single pass). Event-driven runs still require automatic DRS to be enabled for the cluster and honour the existing DRS algorithm and thresholds. Off by default, so nothing changes until an operator opts in.

  2. A "both" DRS metric. In addition to balancing on cpu or memory, the new both metric balances on both together by scoring a candidate migration on the worse of its cpu and memory post-migration imbalance, so a cluster is only considered balanced when both dimensions are.

Types of changes

  • New feature (non-breaking change which adds functionality)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Minor

How Has This Been Tested?

Added unit tests in ClusterDrsServiceImplTest:

  • testShouldTriggerEventDrivenDrsDisabledByDefault: no event-driven run when the setting is off (the default).
  • testShouldTriggerEventDrivenDrsRequiresAutomaticDrs: event-driven runs only when automatic DRS is enabled.
  • testShouldTriggerEventDrivenDrsEnabledThenDebounced: a second event within the interval is debounced.
  • testTriggerEventDrivenDrsForVmSchedulesWhenEnabled and testTriggerEventDrivenDrsForVmDoesNotScheduleWhenDisabled: a VM power-state event schedules a DRS pass only when enabled.

Also built the standard packages and deployed on a KVM advanced zone.

drs.metric gains a "both" option. Cluster imbalance and each candidate
migration's post-imbalance are measured as the worse (max) of the cpu and
memory imbalance, so DRS acts whenever either resource is contended
instead of only the single configured metric.
Adds drs.event.driven.enable (default false) and drs.event.driven.interval
(default 5 min). When enabled for a cluster, ClusterDrsServiceImpl
subscribes to the vm.powerstate message bus, resolves the affected
cluster on each event and generates a plan for it within minutes (rate-
limited per cluster), off the message-bus thread. The existing poll then
executes the plan. Requires drs.automatic.enable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant