Skip to main content

VMware memory hog

VMware memory hog fault consumes excessive memory resources on Linux OS based VMware VMs.

  • It determines the performance of the application running on the VMware VMs.

VMware Memory Hog

Usage

View the uses of the fault
This fault helps determine how resilient an application is when excessive memory is unexpectedly consumed by resources. It simulates the situation of memory leaks in the deployment of microservices, application slowness due to memory starvation, and noisy neighbour problems due to hogging. It verifies pod priority and QoS setting for eviction purposes. It also verifies application restarts on OOM kills.

Prerequisites

  • Kubernetes > 1.16
  • Execution plane is connected to vCenter and the hosts on port 443.
  • VMware tool is installed on the target VM with remote execution enabled.
  • Adequate vCenter permissions to access the hosts and the VMs.
  • Create a Kubernetes secret that has the Vcenter credentials in the CHAOS_NAMESPACE. Below is a sample secret file:
apiVersion: v1
kind: Secret
metadata:
name: vcenter-secret
namespace: litmus
type: Opaque
stringData:
VCENTERSERVER: XXXXXXXXXXX
VCENTERUSER: XXXXXXXXXXXXX
VCENTERPASS: XXXXXXXXXXXXX

Note

You can pass the VM credentials as secrets or as a ChaosEngine environment variable.

Default validations

The VM should be in a healthy state.

Fault tunables

Fault tunables

Mandatory fields

Variables Description Notes
VM_NAME Name of the target VM. For example, ubuntu-vm-1.

Optional fields

Variables Description Notes
MEMORY_CONSUMPTION_MEBIBYTES Amount of memory consumed by VMware VMs (in MiB). For example, 4024.
MEMORY_CONSUMPTION_PERCENTAGE Amount of total memory to be consumed (in percentage). Default to 100.
NUMBER_OF_WORKERS Number of workers used to run the stress process. Defaults to 4.
TOTAL_CHAOS_DURATION Duration that you specify, through which chaos is injected into the target resource (in seconds). Defaults to 30s.
CHAOS_INTERVAL Time interval between two successive instance terminations (in seconds). Defaults to 30s.
SEQUENCE Sequence of chaos execution for multiple instances. Defaults to parallel. Supports serial sequence as well.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s.

Fault examples

Common fault tunables

Refer to the common attributes to tune the common tunables for all the faults.

Memory consumption in mebibytes

It defines the memory consumed by the target VM in mebibytes (MiB) for a duration specified by TOTAL_CHAOS_DURATION environment variable. You can tune it using the MEMORY_CONSUMPTION_MEBIBYTES environment variable.

Use the following example to tune it:

# Memory hog in the VMware VM
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-memory-hog
spec:
components:
env:
# Name of the VM
- name: VM_NAME
value: 'test-vm-01'
# memory consumption value
- name: MEMORY_CONSUMPTION_MEBIBYTES
value: '500'

Workers for stress

It specifies the worker's count for stress. You can tune it using the NUMBER_OF_WORKERS environment variable.

Use the following example to tune it:

# Memory hog in the VMware VM
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: engine-nginx
spec:
engineState: "active"
chaosServiceAccount: litmus-admin
experiments:
- name: VMware-memory-hog
spec:
components:
env:
# Name of the VM
- name: VM_NAME
value: 'test-vm-01'
# Number of workers for stress
- name: NUMBER_OF_WORKERS
value: '4'