Simple Load Testing on Linux

Updated:

With a new server in hand, I decided to run temperature tests under CPU and RAM overload conditions. First, install the necessary load testing tools:

sudo dnf install stress-ng lm_sensors htop sysstat
  • stress-ng: A versatile tool for applying various types of load (CPU, memory, I/O, etc.)
  • lm_sensors: A tool for reading hardware sensor values like temperature, fan speed, and voltage
  • htop: An interactive process viewer for monitoring CPU, memory, and process status in real-time
  • sysstat: Provides tools like sar and mpstat for recording and analyzing system activity

First, configure the sensors for monitoring:

sudo sensors-detect
sudo systemctl enable --now lm_sensors
watch sensors

> k10temp-pci-00c3
> Adapter: PCI adapter
> Tctl:         +52.0°C  
> 
> acpitz-acpi-0
> Adapter: ACPI interface
> temp1:        +20.0°C  
> 
> mt7921_phy0-pci-0100
> Adapter: PCI adapter
> temp1:        +56.0°C  
> 
> amdgpu-pci-6400
> Adapter: PCI adapter
> vddgfx:        1.42 V  
> vddnb:       853.00 mV 
> edge:         +49.0°C  
> PPT:          25.07 W  (avg =   9.12 W)

During sensors-detect setup, you’ll be asked several questions. The default values are generally fine.

Now you can apply various loads to CPU cores, RAM, and I/O:

# Test applying load to all CPU cores
sudo stress-ng --cpu 0 --timeout 60s --metrics-brief 

# Test with 2 virtual memory workers, each using 15GB of memory
sudo stress-ng --vm 2 --vm-bytes 15G --timeout 60s 

# Comprehensive stress test applying load to CPU, memory, and I/O simultaneously
sudo stress-ng --cpu 4 --vm 2 --io 1 --timeout 60s --metrics-brief

These load tests revealed that my initial server setup didn’t adequately consider ventilation. I adjusted the setup to resolve the temperature issues.