Linux stress testing
Hi there!
Today i will talk about stress testing or burn testing Linux machines. For example i bought an old server from friend, it's HP ProLiant DL180 G5. How do i check if it's working stable and everything should work fine under high loads or other circumstances then the server is heavily loaded ? Of course the main tests if you buy new product are to test it's memory (RAM using memtest86), hard disk drives (for bad sectors using badblocks or some 3rdparty software like HD Tune or similar in that direction). But what about CPU and other system components, how do i check if the coolers and all cooling system is working fine ? We need to run CPU intensive app or so called Strees tool. There are stress tool that comes in common. We can install it by issuing command:
apt-get install stressRun simple test:
stress -c 2 -i 1 -m 1 --vm-bytes 128M -t 60s
What all of this mean ? -c parameter specifies on how many cpus (or cores) we run our stress test on. -i parameter specifies how many workers it will spawn on sync(). -m specifies how many workers will be spinning on malloc()/free(). --vm-bytes malloc X bytes per vm worker. -t timeout after X seconds. On other terminal connected via ssh to remote server we can watch the server loads using the following command:
watch uptime
Or you can watch system temperature sensors with the following command:
sensors # (lm-sensors package must be preinstalled)There is also the tool stress-ng it will stress test a computer system in various selectable ways. Let's download it and prepare for testing:
wget http://kernel.ubuntu.com/~cking/tarballs/stress-ng/stress-ng-0.07.18.tar.gz
tar zxvf stress-ng-0.07.18.tar.gz
cd stress-ng-0.07.18
make && make install # (make sure you have development tools apt-get install build-essential)
Usage examples:
stress-ng --cpu 4 --io 2 --vm 1 --vm-bytes 1G --timeout 60s --metrics-brief # 60 seconds with 4 cpu stressors, 2 io stressors and 1 vm stressor using 1GB
stress-ng --cpu 16 --cpu-ops 900000 # Run 16 cpu stressors and stop after 900000 bogo operations
stress-ng --cpu 2 --cpu-method fft --cpu-ops 5000 --metrics-brief # Run 2 FFT cpu stressors, stop after 5000 bogo operations and produce a summary just for the FFT results
stress-ng --cpu 0 --cpu-method all -t 2h # Run cpu stressors on all online CPUs working through all the available CPU stressors for 2 hour
stress-ng --all 2 --timeout 10m # Run 2 instances of all the stressors for 10 minutes
stress-ng --random 128 # Run 128 stressors that are randomly chosen from all the available stressors
stress-ng --cpu 64 --cpu-method all --verify -t 5m --metrics-brief # Run 64 instances of all the different cpu stressors and verify that the computations are correct for 5 minutes with a bogo operations summary at the end
stress-ng --sequential 0 -t 5m # Run all the stressors one by one for 5 minutes, with the number of instances of each stressor matching the number of online CPUs
stress-ng --sequential 8 --class io -t 1m --times # Run all the stressors in the io class one by one for 1 minutes each, with 8 instances of each stressor running concurrently and show overall time utilisation statistics at the end of the run
Have a nice and successful testing! :-)
No comments: