Here is a sample README.md
file for the repository A.2.CPU_Stress
:
# CPU Stress Test
This repository provides scripts and instructions to stress test the CPU on a Linux instance, particularly useful for AWS environments.
## Introduction
CPU stress testing is useful for performance benchmarking and system reliability testing under high load. This repository includes multiple methods to increase CPU stress on a Linux system.
## Installation
To use the provided scripts, you need to have a Linux environment with necessary tools installed. Here are the steps to set up the tools:
### Installing stress-ng
```bash
sudo apt-get update
sudo apt-get install stress-ng
sudo apt-get update
sudo apt-get install stress
To run a CPU stress test with stress-ng
, use the following command:
stress-ng --cpu 4 --timeout 60s
--cpu 4
: Stress 4 CPU cores.--timeout 60s
: Run the stress test for 60 seconds.
To run a CPU stress test with stress
, use the following command:
stress --cpu 4 --timeout 60s
--cpu 4
: Stress 4 CPU cores.--timeout 60s
: Run the stress test for 60 seconds.
You can use a custom shell script to stress the CPU. The cpu_stress.sh
script in this repository can be used as follows:
-
Make the script executable:
chmod +x cpu_stress.sh
-
Run the script:
./cpu_stress.sh
A Python script, cpu_stress.py
, is also provided for CPU stress testing. You can use it as follows:
-
Ensure Python is installed on your system.
-
Run the script:
python3 cpu_stress.py
While running any of these stress tests, you can monitor CPU usage using the top
or htop
command:
top
or
htop
This will allow you to observe the impact of the stress test on the CPU usage of your AWS instance.
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License.
This `README.md` file provides a comprehensive guide on using the CPU stress scripts in the repository, including installation, usage, and monitoring instructions.