Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux environments. make the machine slow

Tags:

linux

This may seem weird, but is there a way to make the machine(linux/unix flavours - preferably RHEL). I need to control the speed of the machine to make sure the code works on very slow systems and identify the right break point (in terms of time)..

One way i can do it is to run some heavy background process. Any other smarter way?

Thanks

like image 695
randeepsp Avatar asked Jul 15 '26 02:07

randeepsp


1 Answers

How to produce high CPU load, memory, I/O or stress test Linux server

Install some prerequisites

On CentOS/RHEL

yum install gcc gcc-c++ autoconf automake

On Debian, Ubuntu

 sudo su -
 apt-get update
 apt-get install build-essential

Download the latest tarball and run configure, make, make install

wget http://pkgs.fedoraproject.org/repo/pkgs/stress/stress1.0.4.tar.gz/a607afa695a511765b40993a64c6e2f4/stress-1.0.4.tar.gz
 tar zxvf stress-1.0.4.tar.gz
 cd stress-1.0.4
 ./configure
 make
 make install

The binary gets installed under /usr/local/bin

To start stress run stress followed by the -c flag for load stress, -m for memory stress, -i for io and -d for HDD. For example to stress cpu execute

stress -c 5

Execution of the command above will hog all available cpu power and create a load five times a single core would happily handle.

Similarly to stress some memory you can execute

 stress -m 512M
like image 101
Rafiqul Islam Avatar answered Jul 17 '26 15:07

Rafiqul Islam