What is easiest way to recognise cause of high load on Linux?

ICPH

Member
What is easiest way to recognize cause of high load on Linux?


I have opportunity to execute some commands in case there is high load on Linux server and send an email with output. My aim is to easilly see if RAM or CPU or I/O caused high load.


Which commands with tiniest, static output (so i can send output via email) can easily tell me which one caused it and possibly reason/detail about the issue?


thank you
 

graeme

Active Member
free -h


top -n 1


and copy and paste the bits you need. With free you almost certainly want the -/+ buffers/cache: line
 

ICPH

Member
thx, but i think this do not give me any idea regarding I/O impact on the load average?


While i have OpenVZ VPS is "%wa" value of the "top" command the thing that can give some idea about VPS I/O usage?


so top gives me idea about CPU usage:


Cpu(s): 16.4%us,  3.1%sy,  0.7%ni, 79.4%id,  0.4%wa


(last "wa" value about how much VPS is overloaded regarding I/O?)


the free gives idea about real RAM usage:


                                    used      free


-/+ buffers/cache:        423       1624


right?
 

graeme

Active Member
No, sorry, do not really know about IO off hand.


You are correct about free. free -h should give you more readable output.


For CPU you can use top and then once you have seen the problem top -n 1 to get a static version of it.
 

DomainBop

Dormant VPSB Pathogen
 install any of these tools:


1. iotop (in/out usage), 2. iftop (network usage), 3. mytop (mysql usage), 4. top or htop (processes), 5. sysstat (in/out, cpu, RAM, network usage, etc, includes iostat and sar command line tools and more http://sebastien.godard.pagesperso-orange.fr/features.html )


assorted command line to find processes, cpu usage: 


ps auxf

Code:
ps -eo pcpu,pid,user,args | sort -k1 -r | head -10

look at the last few lines of dmesg (useful if high load is caused by hardware problem, out of memory, etc


dmesg


find the network connections (IPs) that are making the most connections (useful if high load is caused by a DOS or other attack, etc)

Code:
netstat -plan |grep :80|awk '{print $5}' |cut -d: -f1 |sort |uniq -c |sort -n
 

samK

New Member
The next cause for high load is a system that has run out of available RAM and has started to go into swap. Because swap space is usually on a hard drive that is much slower than RAM, when you use up available RAM and go into swap, each process slows down dramatically as the disk gets used
 

RuskinF

Member
These CLI instructions will help you to find the Load on a Linux server:
How To Check CPU Usage from Linux Command Line
  1. top Command to View Linux CPU Load.
  2. mpstat Command to Display CPU Activity.
  3. sar Command to Show CPU Utilization.
  4. iostat Command for Average Usage.
  5. Nmon Monitoring Tool.
  6. Graphical Utility Option.
 
Top