PDA

View Full Version : Load testing a linux machine



cowman
01-02-2012, 11:24 PM
Simple trick I use all the time to check system stability.
open up a terminal and type

cat /dev/urandom > /dev/null

to stop, hit ctrl + c

This is a single threaded application so you need a separate instance of it for each processor core. You'll find it loads up a single core to nearly 100% cpu usage. What is actually happening here is you're running the cat command which reads from a file, in this case instead of a file we use /dev/urandom which is a random number generator in the linux world. Then instead of having it display all that crap in your terminal(the default) we use the redirection character, > to send it somewhere else. In this case /dev/null which is basically a black hole for dumping unwanted data.

Note that this really does load a system down. It won't crash it(unless it's got hardware issues or other problems) but it will slow the system wayyy down if you run an instance for each CPU core.

TDSP
01-03-2012, 12:06 AM
I use this (http://www.stresslinux.org/sl/) all the damn time, it's one of the things in my PXE folder. It's super useful if you are trying to track down bad hardware or see how well a cooler works. It's a fork off Knoppix.

cowman
01-08-2012, 03:13 AM
Yeah I know there are some good testing suites out there. The nice thing about this is you don't need anything, you type the command and go.