Member-only story

Attack CPU, Memory of a Linux machine using Stress and Stress-ng commands

Asanka Vithanage
2 min readDec 2, 2021

--

It's critical to measure and monitor, of course then take mitigating actions on how our applications behave in case of CPU and memory spike. So as part of application chaos/reliability testing, We need to generate CPU, memory spikes on our systems.

There are so many tools out there in the market which can do these types of attacks. But we can use available simple Linux utilities like Stress and Stress-ng for this purpose.

stress — is a workload generator tool designed for POSIX systems. It can generate a configurable amount of CPU, memory, I/O, and disk stress on your machine.

stress-ng — is an updated version of the stress workload generator tool which tests your system for the following features:

  1. CPU compute
  2. drive stress
  3. I/O syncs
  4. Pipe I/O
  5. cache thrashing
  6. VM stress
  7. socket stressing
  8. process creation and termination
  9. context switching properties

First, we need to install these tools on the machines which need to be attacked.

The following steps can be used based on your system

For Debian, Ubuntu, and Mint

sudo apt-get install stresssudo apt-get install stress-ng

--

--

Asanka Vithanage
Asanka Vithanage

Written by Asanka Vithanage

Software Quality Assurance Professional, Problem Solver, SOA Tester, Automation Engineer, CI/CD Practitioner, DevOps enthusiast

No responses yet