Put the server on a heavy load for testing

I am testing on a Linux server and I need the server to be under heavy load. I was wondering how I will simulate this? Now the server goes to a 20% processor, but I need to get it to about 80% and do some testing to understand how it is doing.

+7
source share
2 answers

If you want to force the processor, try the following:

for cpu in 1 2 ; do ( while true; do true; done ) & done 

If you also want to switch the I / O board, try this:

 for cpu in 1 2 ; do ( while true; do find / -type f -exec cp {} /dev/null \; ; done ) & done 

with for cpu in 1 2 for two cores, for cpu in 1 2 3 4 for 4 cores;)

+11
source

If you are looking for processor generation, so you need to choose commands with processor intensity. For example, random number generation.

Try the following:

 dd if=/dev/urandom of=/dev/null 

Add from this line for each CPU core. If you have a dual-core processor, use:

 dd if=/dev/urandom of=/dev/null & dd if=/dev/urandom of=/dev/null & 

Check jobs with

 jobs 

Quit using kill %1 (where% 1 is job number 1)

+2
source

All Articles