Performance is the very basic and essential for any server system. Linux comes with a number of tools that come in handy for any system administrator. This article presents some of these tools for monitoring performance of the system.
The top command is an interactive command that monitors the current system state. It provides the real-time, dynamic information about the system. It displays the summary information such as system uptime, number of users logged in, running, sleeping, stopped and zombie processes etc. Rest it provides information about the current processes, such as PID, owner of process, %CPU used, %MEM used by the process, name of command etc. To run top, enter the following command:
sar command is provided by the sysstat package. To install and run sar command, sysstat package needs to be installed. This command collects and reports system activity information. The information provided by this command includes CPU usage (collective and individual), Memory and SWAP space used (and available), I/O, data load, network activities etc. It provides flexibility to select information about specific system activities using flags. The common usage for this command is:
As the name suggests, vmstat tells about virtual memory statistics. Virtual memory is the space on the hard drive that can be used as memory (virtual), to swap in and swap out when the physical memory is not enough for maintaining the performance of the system. According to the manual page, “Vmstat reports information about processes, memory, paging, block IO, traps, disks and cpu activity. The first report produced gives averages since the last reboot. Additional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case.”
This command reports the CPU utilization and the disk I/O statistics. The output contains the information about the kernel, current date, system architecture, number of CPUs (or cores in case of multi core CPUs). It also displays average CPU usage at user level (with and without nice priority), at system level, during I/O request, during idle times, and the percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor etc. I found this page more useful to learn more about linux iostat command.
The information about the device includes KB’s read and written and the reading and writing speed (KB/s).
The mpstat command, like sar and iostat command is given by the sysstat utility. All you need to do is install the sysstat package for these three useful tools. The mpstat command reports global and per-processor statistics. According to the manual page, “The mpstat command writes to standard output activities for each available processor, processor 0 being the first one. Global average activities among all processors are also reported. The mpstat command can be used both on SMP and UP machines, but in the latter, only global average activities will be printed. If no activity has been selected, then the default report is the CPU utilization report.”
These tools are very important tools for administering a Linux system. More information about these tools is available in their respective manual pages.
This is an article by our Guest blogger Bobbin (Nixsavy)