Linux CPU stress
Linux CPU stress fault applies stress on the CPU of the target Linux machines for a specific duration.
Use cases
- Induces CPU stress on the target Linux machines.
- Simulates a lack of CPU for processes running on the application, which degrades their performance.
- Simulates slow application traffic or exhaustion of the resources, leading to degradation in the performance of processes on the machine.
note
- This fault can be executed on Ubuntu 16 or higher, Debian 10 or higher, CentOS 7 or higher, RHEL 7 or higher, and openSUSE LEAP 15.4 or higher.
- The
linux-chaos-infrastructure
systemd service should be in an active state, and the infrastructure should be inCONNECTED
state.
Fault tunables
Optional tunables
Tunable | Description | Notes |
---|---|---|
load | Percentage load to be exerted on a single CPU core. | Default: 100 %. |
workers | Number of worker processes to start. Corresponds to the number of CPU cores to consume. | Default: 1. |
duration | Duration through which chaos is injected into the target resource (in seconds). | Default: 30 s. |
rampTime | Period to wait before and after injecting chaos (in seconds). | Default: 0 s. |
Workers
The workers
input variable utilizes a specific number of workers for the CPU stress fault.
The following YAML snippet illustrates the use of this environment variable:
# workers to utilize
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-cpu-stress
labels:
name: cpu-stress
spec:
stressChaos/inputs:
workers: 1
load: 100
Load percentage
The load
input variable exerts the CPU load (in percentage) per core.
The following YAML snippet illustrates the use of this environment variable:
# percentage load to exert per core
apiVersion: litmuchaos.io/v1alpha1
kind: LinuxFault
metadata:
name: linux-cpu-stress
labels:
name: cpu-stress
spec:
stressChaos/inputs:
workers: 3
load: 70