CPU Burn

Sometimes you may wish to test the CPU to see how the server / application reacts under heavy load. There is 2 main ways to achieve this, the first is where by the server is having a real heavy load and the second is where by you simulate the load. In this guide, we will look to simulate the load from the command line.

yes > /dev/null &

The above command would lead one of the CPU to be engaged at 100% consumption. This will set it as an background task and it will continue to run until the process has been closed. 

You can continue to run the command over and over gain, each time its executed again, it will create another process in the background.

Once you have finish with the test on the CPU, you would need to stop the processes otherwise they will consume all the CPU resources and starving other services from the CPU. To do this, we will look to terminate the processes.

killall yes

All the processes are called yes, by issuing the above command, it will close all the active processes which is running called ‘yes’.