There are couple of commands or utility in Linux which helps in troubleshooting the unexpected behaviour of Linux functionality.
Few of the listed utilities are:
7.iostat and many more.
Lets deal with each in detail:
Uptime reports the current time,the amount of time machine has been up an d running,current number of users,load average in last minute, five minutes and 15 minutes.
$ uptime 18:24:44 up 11 days, 8:37, 3 users, load average: 3.24, 6.34, 4.42
In the above output, the machine has undergone load average of more than 3 in last minutes, load average of more than 6 in last five minutes and more than 4 in last fifteen minutes.
In a 1-CPU system, a load average of over 1 means that the CPU is under powered for the type of load you are supplying.Because of the multi-process nature of LINUX/UNIX, it is generally acceptable for a load average of up to two over the long term (in other words, the fifteen minute figure) before you should be concerned.
In a multi-CPU system, just divide the load average by the number of CPUs. To determine if the machine is over stressed, use the same principles as above.
Monitoring the virtual memory statistics with the vmstat tool would be the next weapon. It accepts a numerical interval just like the crazy iostat.
$ vmstat 4
kthr memory page disk faults cpu r b w swap free re mf pi po fr de sr dd s1 -- in sy cs us sy id 0 0 0 2810868 809534 94 425 122 69 40 0 26 16 0 0 287 1322 262 9 4 87 0 0 0 2824652 778872 2 7 0 0 0 0 0 0 0 0 228 32 108 0 1 99 0 0 0 2824752 778872 0 0 0 0 0 0 0 2 0 0 223 26 115 0 0 100 0 0 0 2824752 778872 0 0 0 0 0 0 0 0 0 0 225 23 109 0 0 100
As show above, the vmstat tool shows the following information:
page faults, and
The CPU or thread blockw reflects the processes/threads in the run queue (r), blocked processes waiting for I/O resources (b), and those that were swapped.
High numbers in the blocked processes column indicates slow disks. High numbers in the swapped column indicate that there are two many processes using too much memory that need to be swapped in and out. Swapping is an expensive process and will significantly degrade your system.
The memory shows the amount of swap currently available and the size of the free list (the number of pages that could be swapped if the RAM were requested).
Low swap values indicate that you are running out of swap space, which doesn't necessarily show a problem, as long as you have enough RAM to run the applications. Low free list values might indicate that you have a lot of active RAM in use, which might trigger swap space use if you add more processes to the system.
The page columns show the pages of memory swapped in and out to disk. The key columns are the pi/po (page in/page out), which indicate how many pages have been exchanged. High paging indicates a lack of RAM; a high scan rate (the sr column) shows a potential memory bottleneck.
We discussed about the first two tools in details this time. Next time, we will discuss more on the other utilities.
Hope you have fun reading this page.