PDA

View Full Version : Quickly discover Linux high load cause - HDD, CPU, RAM



Fli
11-15-2014, 06:36 PM
Hello,

please can anyone share the script or application which allows quick discovery what is causing high load on Linux server?

I mean if its HDD I/O or CPU or RAM or Network overload?

So far i found command:
iostat 5 4;echo "---RAM USAGE---";echo "";free -m | grep buffers;echo "";echo "---DISK SPEED---";dd if=/dev/zero of=test bs=64k count=1k conv=fdatasync;rm -rf test;echo "";

171

%idle is how much CPU is free (so there we see CPU is not issue)
tps is HDD transactions per second. Standard 7000RPM HDD is like up to like 110tps, if more, then %iowait value is raising and server is lagging and delaying


If high tps (HDD is cause) then one can do following commands to discover top HDD processes:

iotop -ao
iotop -o -b -n 1 -d 2 -t

DSTAT & NMON

"nmon" for linux. Install:
A) Centos 6,64bit: rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
B) Centos 5,64bit: rpm -ivh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

yum install nmon -y

nmon returns like:
169

command: nmon and then type: v,l,d,n,m (vldnm) h for help

------

install "dstat" which shows, cpu usage, hdd bandwidth, network usage

168
(it don't show HDD transactions per second - tps which is often more important than data bandwidth)

dstat -vts --disk-util --top-io --top-bio --noheaders --nocolor

---procs--- ------memory-usage----- ---paging-- -dsk/total- ---system-- ----total-cpu-usage---- ----system---- ----swap--- sda- ----most-expensive---- ----most-expensive----
run blk new| used buff cach free| in out | read writ| int csw |usr sys idl wai hiq siq| date/time | used free|util| i/o process | block i/o process
0 0 51|9.95G 470M 9.91G 3161M| 2B 17B|1073k 1158k|8443 12k| 5 1 92 1 0 0|27-05 09:32:13| 51M 12G|25.3|mysqld 21M 6500k|init 489k 318k
3.0 0 24|9.99G 470M 9.91G 3119M| 0 0 | 0 500k|9047 14k| 5 2 93 0 0 0|27-05 09:32:14| 51M 12G|2.30|mysqld 73M 145k|denyhosts.p 0 500k
3.0 0 22|10.1G 470M 9.91G 3046M| 0 0 |8192B 316k| 10k 14k| 8 2 89 0 0 0|27-05 09:32:15| 51M 12G|9.10|mysqld 14M 268k|denyhosts.p 0 112k
2.0 0 19|10.1G 470M 9.91G 2958M| 0 0 | 0 24k|9304 14k| 9 2 89 0 0 0|27-05 09:32:16| 51M 12G|0.20|mysqld 31M 17M|httpd 0 24k
3.0 0 12|10.0G 470M 9.91G 3097M| 0 0 | 108k 444k|8702 14k| 5 2 93 1 0 0|27-05 09:32:17| 51M 12G|15.6|mysqld 17M 227k|jbd2/dm-0-8 0 128k
1.0 0 27|9.98G 470M 9.91G 3128M| 0 0 | 0 132k|7916 13k| 4 2 94 0 0 0|27-05 09:32:18| 51M 12G|10.6|init 1722k 648B|init 0 20k

For the bash script usage, one can do: dstat -vts --disk-util --top-io --top-bio --noheaders --nocolor 5 3 > logfile