What is the average machine load?
The number of processes queued for CPU processing during a specific time interval, the more processes queued, the slower CPU processing, and the average load on the machine
How do I measure whether the current system is overloaded?
If the current number of active processes on each CPU (which can be calculated by the number of CPU cores) is not greater than 3, the system performs well,
Not greater than 4, which means that it can accept
If more than 5, the system performance problem is serious
The recommended set of strict alarm values is: The number of CPU cores
For example: The number of CPU cores is 2, then set the alarm value to 2
(This setting is reasonable, because not every application supports multi-CPU and multi-core)
When do I need to see the load on my machine?
When your system request is slow and unbearable.
How to view? Common commands:
UpTime: It shows the number of active user processes and the so-called average load indicator (load average) since the last system restart.
11:38:54 |
Current time |
Up 708 days |
System Run time |
2 users |
Number of currently logged on users |
Load average:0.08, 0.02, 0.01 |
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. |
Top: Dynamic Display
1. The first line is the task queue information
Results of execution with uptime command:
[Email protected] ~]# uptime
13:22:30 up 8 min, 4 users, Load average:0.14, 0.38, 0.25
The contents are as follows:
12:38:33 |
Current time |
Up 50days |
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. |
2. Second to third behavioral 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 |
|
0.0% si |
|
3.45th Behavior Memory information.
The contents are as follows:
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. |
Two. Process information
Column Name |
Meaning |
Pid |
Process ID |
PPID |
Parent Process ID |
Ruser |
Real User Name |
Uid |
User ID of the process owner |
USER |
User name of the process owner |
GROUP |
Group Name of Process owner |
Tty |
The terminal name of the startup process. Processes that are not started from the terminal are displayed as? |
PR |
Priority level |
NI |
Nice value. Negative values indicate high priority, positive values indicate low priority |
P |
Last CPU used, only meaningful in multi-CPU environment |
%cpu |
CPU time consumption percentage last updated to current |
Time |
Total CPU time used by the process, in seconds |
time+ |
Total CPU time used by the process, Unit 1/100 sec |
%MEM |
Percentage of physical memory used by the process |
VIRT |
The total amount of virtual memory used by the process, in kilobytes. Virt=swap+res |
SWAP |
The size, in kilobytes, of the virtual memory that the process is using, swapped out. |
Res |
The size, in kilobytes, of the physical memory that the process used and was not swapped out. Res=code+data |
CODE |
The amount of physical memory the executable code occupies, in kilobytes |
DATA |
The amount of physical memory that is used by parts other than executable code (data segment + stack), in kilobytes |
Shr |
Shared memory size, in kilobytes |
Nflt |
Number of page faults |
Ndrt |
The number of pages that were modified the last time it was written to. |
S |
Process state. d= non-disruptive sleep state R= Run S= Sleep t= Tracking/Stopping z= Zombie Process |
COMMAND |
Command name/command line |
Wchan |
If the process is sleeping, the system function name in sleep is displayed |
Flags |
Task Flag, reference sched.h |
How to view the average load on a Linux machine