How to generate max CPU Load (stress test your CPU)

It’s a bit of a random thing you’d think, but recently I had an issue where one of my servers would keep dieing when under abnormal load… So I thought, how can i replicate this in a lab environment… So I wrote a tiny bash script (that you can just paste into a terminal) that will max out each “thread” of the CPU until you kill the processes or reboot… Useful for stress-testing or burning in a CPU…

Quad Core (with hyperthreading):

for cpu in 1 2 3 4 5 6 7 8; do
( while true; do true; done ) &
done

Dual Core (with hyperthreading):

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

 

 

 

 

Leave a Reply