Top of system monitoring and diagnostic tools

Source: Internet
Author: User
Tags hosting

You may not be unfamiliar with the top command, its role is mainly to monitor the system real-time load rate, process resource utilization and other System state properties are normal.

The top command is as follows:

(1) System and Task statistic information:

The first 8 lines are the statistical information of the system as a whole. Line 1th is the task queue information, with the result of the execution of the uptime command. The contents are as follows:

01:06:48 Current time
Up 1:22 System run time, format last: minutes
1 user Number of currently logged on users
Load average:0.06, 0.60, 0.48 System load, which is the average length of the task queue.

The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.

Note: these three values can be used to determine if the system is overloaded--if the value

continues to be larger than the number of system CPUs, you need to optimize your program or architecture.

(2) process, CPU statistic information:

The 2nd to 6th behavior process and CPU information. When there are multiple CPUs, the content may be more than two lines. The contents are as follows:

tasks:29 Total Total number of processes
1 Running Number of processes that are running
Sleeping Number of processes for sleep
0 stopped Number of processes stopped
0 Zombie Number of zombie processes
Cpu (s): 0.3% US Percentage of CPU occupied by user space
1.0% Sy Percentage of CPU consumed by kernel space
0.0% ni CPU percentage of processes that have changed priority in user process space
98.7% ID Percentage of idle CPU
0.0% WA Percentage of CPU time waiting for input and output
0.0% hi Hardware IRQ
0.0% si Software IRQ

Note:

(1) IRQ:IRQ is all called the interrupt request, which means "interrupt requests".

(2) St (Steal Time): Steal time is the percentage of time a virtual CPU waits for a real CPU while the hypervisor is servicin G another virtual processor. It ' s only relevant in virtualized environments. It represents time when the real CPU is not available to the current virtual machine-it is "stolen" from this VM by th e hypervisor (either to run another VMS, or for its own needs).

So, relatively speaking, what is does this mean? A High steal percentage may mean so you may be outgrowing your Vsan with your hosting company. Other virtual machines could have a larger slice of the CPU's time and you could need to ask for a upgrade in order to Compet E. Also, a high steal percentage could mean that your hosting company are overselling virtual machines on your particular SER Ver. If you upgrade your Vsan and your steal percentage doesn ' t drop, you may be want to seek another provider. A low steal percentage can mean that your applications is working well with your current virtual machine. Since your VMS are not wrestling with other VMs ' s constantly for CPU time, your VM would be more responsive. This could also suggest that your hosting provider was underselling their servers, which is definitely a good thing.0.0% Sisi (software interrupts)
(3) last two Behavior memory information:
MEM:191272K Total Total Physical Memory
173656k used Total amount of physical memory used
17616k Free Total Free Memory
22052k buffers Amount of memory to use as the kernel cache
SWAP:192772K Total Total Swap Area
0k used Total number of swap areas used
192772k Free Total Free Swap Area
123988k Cached The total amount of buffer swap area. The in-memory content is swapped out to the swap area and then swapped in to memory, but the used swap area has not been overwritten, which is the size of the swap area where the content already exists in memory . When the corresponding memory is swapped out again, it is no longer necessary to write to the swap area.

PS: How do I calculate available memory and used memory?

In addition to FREE-M, you can also look at top:

mem:255592k Total, 167568k used, 88024k free, 25068k buffersswap:524280k total, 0k used, 524280k F REE, 85724k Cached
3.1 Actual program available memory how to calculate?

The answer Is:free + (buffers + cached)

88024k + (25068k + 85724k) = 198816k

3.2 The number of memory used in the program how to calculate it?

The answer is:used– (buffers + cached)

167568k– (25068k + 85724k) = 56776k

3.3 How to tell if the system is not enough memory?

If your swap used value is greater than 0, you can basically tell that you have experienced a memory bottleneck, either optimizing your code or adding memory.

3.4 The difference between buffer and cache

A buffer is something that have yet to being "written" to disk. A cache is something that have been "read" from the disk and stored for later using from the application point of view, buffers/cached is equal to available because buffer/ Cached is designed to improve the performance of file reads and writes, and buffer/cached is quickly recycled when applications need to use memory. So from the application's point of view, available memory = System Free Memories + buffers + cached.

Buffers is the buffer size used to make a block device, and he only records the metadata of the filesystem and tracking in-flight pages. Cached is used to buffer files. That is to say: buffers is used to store, what content inside the directory, permissions and so on. and cached directly to the memory of our open files, if you want to know if he is really effective, you can try, successively executed two times the command #man X, you can obviously feel that the second opening is much faster.

Experiment: Doing something on a machine with no application can be seen more clearly. Remember that the experiment can only be done once, if you want to do more please change a file name.

#free #man x #free #man x #free You can compare the size of the buffers after free. Another experiment: #free #ls/dev #free You compare the size of two, of course, this buffers is increasing at any time, but you have LS, the increased speed will become faster, this is the difference between buffers/chached. Because Linux uses your temporary unused memory as a file and data cache to improve system performance, when you need these memory, the system will automatically release (unlike Windows, even if you have a lot of free memory, he will have access to the disk pagefiles)

(4) Process information area:

The details of each process are shown below the statistics area. Let's start by understanding the meaning of the columns.

Serial number Column Name Meaning
A Pid Process ID
B PPID Parent Process ID
C Ruser Real User Name
D Uid User ID of the process owner
E USER User name of the process owner
F GROUP Group Name of Process owner
G Tty The terminal name of the startup process. Processes that are not started from the terminal are displayed as?
H PR Priority level
I NI Nice value. Negative values indicate high priority, positive values indicate low priority
J P Last CPU used, only meaningful in multi-CPU environment
K %cpu CPU time consumption percentage last updated to current
L Time Total CPU time used by the process, in seconds
M time+ Total CPU time used by the process, Unit 1/100 sec
N %MEM Percentage of physical memory used by the process
O VIRT The total amount of virtual memory used by the process, in kilobytes. Virt=swap+res
P SWAP The size, in kilobytes, of the virtual memory that the process is using, swapped out.
Q Res The size, in kilobytes, of the physical memory that the process used and was not swapped out. Res=code+data
R CODE The amount of physical memory The executable code occupies, in kilobytes
S DATA The amount of physical memory that is used by parts other than executable code (data segment + stack), in kilobytes
T Shr Shared memory size, in kilobytes
U Nflt Number of page faults
V Ndrt The number of pages that were modified the last time it was written to.
W S Process state. D= non-interruptible sleep state R= run S= Sleep T= trace/Stop Z= Zombie Process
X COMMAND Command name/command line
Y Wchan If the process is sleeping, the system function name in sleep is displayed
Z Flags Task Flag, reference sched.h

Top of system monitoring and diagnostic tools

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.