Operations 4 min read

How to Install and Use the Linux stress Tool for Server Stability Testing

This guide explains how to install the Linux stress utility, describes its key command‑line options, and shows practical examples for stressing CPU, memory, and disk I/O to evaluate server stability under load.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Install and Use the Linux stress Tool for Server Stability Testing

The stress tool is a Linux utility for generating high‑load conditions to test software and server stability. It can simulate CPU, memory, and I/O stress, helping engineers assess how applications behave under resource pressure.

Installation

Local tarball method :

1 下载地址:https://fossies.org/linux/privat/stress-1.0.4.tar.gz
2 sudo tar -zxvf stress-1.0.4.tar.gz
3 cd stress-1.0.4/
4 ./configure
5 make
6 make check
7 make install
8 stress --version
9 终端显示:stress 1.0.4 安装成功

Online installation (Debian/Ubuntu) :

sudo apt update
sudo apt install stress

Common Options

-v            Show version information
-c N          Launch N CPU workers that run sqrt() loops
-i N          Launch N workers that call sync() for disk I/O
-m N          Launch N workers that call malloc()
-d N          Launch N workers that execute write()
-t SECS       Run the test for SECS seconds

Usage Examples

CPU Stress

Generate four CPU‑bound processes:

stress -c 4

Memory Stress

Allocate 500 MiB in two child processes and keep it allocated: stress --vm 2 --vm-bytes 500M --vm-keep Allocate 500 MiB, sleep for 5 seconds, then release (repeat):

stress --vm 2 --vm-bytes 500M --vm-hang 5

Disk I/O and Space Stress

Create two processes that each write 500 MiB files and continuously sync to disk for 5 seconds:

stress -i 2 -d 2 --hdd-bytes 500M --timeout 5

Testing Strategy

When evaluating an application or web service, it is insufficient to test only under ideal, static conditions. Real‑world deployments experience fluctuating resources and concurrent workloads. By using stress or custom scripts to simulate CPU, memory, and I/O pressure, testers can observe how the service behaves during resource spikes, ensuring it remains stable and handles external disturbances gracefully.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Performance TestingLinuxDisk I/Omemory pressureCPU loadserver stabilitystress
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.