Linux System Performance Monitoring)

Source: Internet
Author: User

Linux provides a very good file Virtual System (/proc) to monitor system performance. The/proc file virtual system is a mechanism used by the kernel and kernel module to send information to processes. It exists in the memory instead of the hard disk. The main functions of the/proc file virtual system include process information, system information, CPU information, load information, and system memory information.

1. Monitoring System Load

1. Run the uptime command to view the system load. The average system load refers to the average number of processes in the queue running at a specific interval. If a process is not waiting for the results of the I/O operation and enters the running status, it is in the running queue.

 
# Uptime15: 44: 50 up, 4 Users, load average: 2.11, 0.66, 0.26

The above shows that the average system load in the last minute is 2.11, the average system load in the last five minutes is 0.66, and the average system load in the last 15 minutes is 0.26, there are 4 users in total. Assume that the system has only one CPU, indicating that the current number of tasks is 2.11. If the system has two CPUs, the current number of tasks is 2.11/2 = 1.055, it indicates that the system performance is still good.

2. Use the CAT/proc/loadavg command

 
# Cat/proc/loadavg0.40 0.79 0.70 2/245 4101

CAT/proc/loadavg provides the following data: average load per second; average load per five seconds; average load per 15 seconds; Total number of jobs; Total number of Running jobs.

 

2. Monitor process running

The Linux system provides PS and top commands to monitor the running status of processes. Based on the monitoring status, some corresponding measures are taken to improve the system performance.

For example, run the PS-Ef | more command to check which processes are running and the running status. Such as whether the process is terminated, whether there are dead processes, and which processes occupy excessive resources.

3. Monitor memory usage

The system is running, because the physical memory is often insufficient, you need to use the virtual memory to solve this problem.

By sharing the virtual memory between processes, the system seems to have more memory than the actual memory. The Linux system supports Virtual Memory, that is, the disk is used as the Ram Extension to expand the available memory.

(1) monitors memory usage in real time in Linux systems. Generally, the free command is used to monitor memory usage.

(2) Use the vmstat command to monitor the virtual memory usage, processes, and CPU activity of the system.

 
# Vmstat 3 3

4. Monitor CPU usage

In Linux, top and mpstat tools are used to monitor CPU usage.

5. Monitor I/O performance

In the liinux system, you can use the iostat command to monitor disk I/O performance. However, the iostat command can only analyze the overall situation. View the I/O details of the/dev/hdb6 partition.

 
# Iostat-x/dev/hdb6

6. Run the CAT/proc/STAT command

# Cat/proc/stat cpu 16015 1353 28840 101677 3602 664 4323 16015 cpu0 1353 28840 101677 3602 664 4323 intr 1605646 1565008 8664 52 0 4 0 6 0 1 296 16675 1418 0 0 13518 ctxt 617320 btime 1178342189 processes 4236 procs_running 2 procs_blocked 0

Note:

The CAT/proc/STAT command contains kernel statistics and provides the following data:

CPU and CPU 0, each parameter in each line means (in the first behavior example:

    1. User (432661) indicates the CPU time (unit: jiffies) of the user State from the start of the system to the current time. The nice value is not a negative process.
    2. 1 jiffies = 0.01 seconds
    3. Nice (13295) indicates the CPU time occupied by processes whose nice value is negative (unit: jiffies) from the time the system starts to the current time)
    4. System (86656) accumulates from system startup to current time, core time (unit: jiffies)
    5. Idle (422145968) accumulates from system startup to current time, except hard disk Io wait time (unit: jiffies)
    6. Iowait (171474) accumulates from system startup to current time, hard disk Io wait time (unit: jiffies ),

7. SAR

The SAR command collects, views, and records performance data. This command has a longer history than the previous commands. It can collect and display long-period data.


8. 6 system monitoring tools

1. htop -- http://htop.sourceforge.net/A process viewer that allows users to interact with it. Application as text modeProgramIs mainly used in the console or X terminal. Currently, the process can be viewed in a tree, with color themes and customization supported.

2. dstat -- A http://dag.wieers.com/home-made/dstat/ tool used to replace vmstat, iostat, netstat, nfsstat, and ifstat commands, is an all-around system information statistics Tool.

3. bmon-http://freshmeat.net/projects/bmon/ an easy-to-use software that helps you monitor Bluetooth devices.

4. iftop-http://www.ex-parrot.com/pdw/iftop/ is mainly used to display the network traffic of the Local Machine and the Traffic sets of communication between each other, such as the traffic size between the same machine separately, very suitable for the use of proxy server and iptables Server

. Ifstat -- http://gael.roualland.free.fr/ifstat/ a very good software for Detecting Network Activity Status

6. sysstat-The http://pagesperso-orange.fr/sebastien.godard/ contains a set of tools that monitor system performance and efficiency for the collection and analysis of system performance data such as CPU usage, hard disk and network throughput data that we collect, it helps us determine whether the system is running normally. It is a good assistant for improving system operation efficiency and running servers safely.

 

Original from: http://www.lupaworld.com/forum.php? MoD = viewthread & tid = 65263.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.