Windows CPU stress
Windows CPU stress applies stress on the CPU resources of Windows OS VM.
- It checks the performance of the application running on the Windows VMs.
Use cases
- Windows CPU stress determines the resilience of an application when stress is applied on the CPU resources of Windows VM.
- Windows CPU stress simulates the situation of lack of CPU for processes running on the application, which degrades their performance.
- It helps verify metrics-based horizontal pod autoscaling as well as vertical autoscale, that is, demand based CPU addition.
- It verifies the autopilot functionality of cloud managed clusters.
Prerequisites
- Ensure that the prerequisites are fulfilled before executing the experiment.
Mandatory tunables
Tunable | Description | Notes |
---|---|---|
CPU_CORES | Number of CPU cores subject to CPU stress. | CPU_CORES and CPU_PERCENTAGE are mututally exclusive, and if values for both there tunables are provided, the latter takes precedence. For example, if CPU_CORES is 1 and CPU_PERCENTAGE is 0, one of the cores are stressed. For more information, go to CPU cores. |
CPU_PERCENTAGE | Percentage of CPU core that is consumed. | CPU_CORES and CPU_PERCENTAGE are mututally exclusive, and if values for both there tunables are provided, the latter takes precedence. For example, if CPU_CORES is 1 and CPU_PERCENTAGE is 50, 50 percent of the resources are stressed. For more information, go to CPU percentage. |
TOTAL_CHAOS_DURATION | Duration that you specify, through which chaos is injected into the target resource (in seconds). | Default: 60s. For more information, go to duration of the chaos. |
Optional tunables
Tunable | Description | Notes |
---|---|---|
RAMP_TIME | Period to wait before and after injecting chaos (in seconds). | For example, 30s. For more information, go to ramp time. |
CPU cores
The CPU_CORE
environment variable applies stress on the target Windows VM for a specific duration. If the variable is set to 0
, the fault consumes all the available CPU resources.
Following YAML snippet illustrates the use of this input variable.
# CPU hog in the Windows VM
apiVersion: litmuschaos.io/v1alpha1
kind: MachineChaosExperiment
metadata:
infraType: "windows"
spec:
engineState: "active"
steps:
- - name: windows-cpu-stress
tasks:
- name: windows-cpu-stress
infraId: ""
definition:
chaos:
fault: windows-cpu-stress
env:
# CPU cores for stress
- name: CPU_CORES
value: '1'
CPU percentage
The CPU_PERCENTAGE
environment variable specifies the percentage of stress applied on the target Windows VM for a specific duration. If the variable is set to 0
, the fault consumes all the available CPU cores.
Following YAML snippet illustrates the use of this input variable.
# CPU hog in the Windows VM
apiVersion: litmuschaos.io/v1alpha1
kind: MachineChaosExperiment
metadata:
name: windows-cpu-stress
spec:
infraType: "windows"
steps:
- - name: windows-cpu-stress
tasks:
- name: windows-cpu-stress
infraId: ""
definition:
chaos:
fault: windows-cpu-stress
env:
# CPU cores for stress
- name: CPU_PERCENTAGE
value: '50'
note
If both CPU_CORE
and CPU_PERCENTAGE
are set to 0, no stress is applied on any of the Windows machine resources.