Skip to main content

VMware Windows CPU hog

VMware Windows CPU hog applies stress on the CPU resources on Windows OS based VMware VM.

  • It checks the performance of the application running on the VMware Windows VMs.

VMware Windows Cpu Hog

Use cases

  • VMware Windows CPU hog determines the resilience of an application when stress is applied on the CPU resources of a VMware Windows virtual machine.
  • VMware Windows CPU hog simulates the situation of lack of CPU for processes running on the application, which degrades their performance.
  • It also 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

  • Kubernetes > 1.16 is required to execute this fault.

  • Execution plane should be connected to vCenter and host vCenter on port 443.

  • Adequate vCenter permissions should be provided to access the hosts and the VMs.

  • VMware tool should be installed on the target VM with remote execution enabled.

  • The VM should be in a healthy state before and after injecting chaos.

  • Kubernetes secret has to be created that has the Vcenter credentials in the CHAOS_NAMESPACE.

  • VM credentials can be passed as secrets or as a chaos enginer environment variable.

apiVersion: v1
kind: Secret
metadata:
name: vcenter-secret
namespace: litmus
type: Opaque
stringData:
VCENTERSERVER: XXXXXXXXXXX
VCENTERUSER: XXXXXXXXXXXXX
VCENTERPASS: XXXXXXXXXXXXX

Mandatory tunables

Tunable Description Notes
VM_NAME Name of the target VM. For example, ubuntu-vm-1
VM_USER_NAME Username of the target VM. For example, vm-user.
VM_PASSWORD User password for the target VM. For example, 1234. Note: You can take the password from secret as well.

Optional tunables

Tunable Description Notes
CPU_CORES Number of CPU cores subject to CPU stress. Default: 0. Indicates that all the avaialble CPU resources are consumed. For more information, go to CPU cores.
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.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s. For more information, go to ramp time.
SEQUENCE Sequence of chaos execution for multiple instances. Default: parallel. Supports serial sequence as well. For more information, go to sequence of chaos execution.
DEFAULT_HEALTH_CHECKDetermines if you wish to run the default health check which is present inside the fault. Default: 'true'. For more information, go to default health check.

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.

Use the following example to specify CPU cores:

# CPU hog in the VMware VM
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: vmware-windows-cpu-hog
spec:
components:
env:
# Name of the VM
- name: VM_NAME
value: 'test-vm-01'
# CPU cores for stress
- name: CPU_CORES
value: '1'