Performance test-some commands for viewing performance on Linux platform

 In the Linux system, the load of the system is also an important indicator of test performance. You can analyze the load of the system through the uptime, top, and w commands;

uptime


The uptime command is mainly used to obtain the running time of the host and query information such as the load of the Linux system;

1) The longer the running time of the system, the more stable the system. Of course, you can also see from the current running time whether the system has been restarted;
2) You can know how many login users there are in the current system;
3) The average load of the system means the average number of processes in the running queue within a specific time interval;
 
The number of currently active processes per CPU core (indicated by x)
x<=0.8
Indicates that the system is idle
1<x<=3
Indicates that the system is normal
x>5
Indicates that the system has a problem
x>15
Indicates that the system load is severe

 

top


The top command is similar to the Windows task manager. It can provide information such as system load, CPU distribution, memory usage, and memory usage of each process for all running processes and systems;
  • Task queue
Equivalent to uptime command;
  • Process status
Tasks — Tasks (processes), the system now has a total of 139 processes, of which 1 is running, 138 are sleeping, 0 are in stopped state, and 0 are in zombie state (zombie)
Detailed explanation of the top command-5 states
 
D
Uninterruptible sleep, usually in IO blocking
R
Running state running or runnable
S
Interruptible sleep
T
Being tracked or stopped
WITH
Zombie process
  • CPU status information
CPU (s): represents the average value of the current CPU. The default display is the average value, press the keyboard "1" to view the usage of each logical CPU
Detailed explanation of each field in the CPU status information
 
The various fields in the CPU
details
The meaning of the fields displayed in the query list
us
  user: CPU time of the running (unadjusted priority) user process
0.0%us
sy
system: CPU time to run the kernel process
0.3% sy
ni
niced: CPU time to run the user process with adjusted priority
0.0% ni
id
Free CPU percentage
99.7%id
wa
IO wait: CPU time used to wait for IO completion
0.0% wa
hi
CPU time to handle hardware interrupts
0.0%hi
and
CPU time to handle software interrupts
0.0% and
st
The CPU time stolen by this hypervisor (Annotation: If the VM is currently under a hypervisor, the hypervisor actually consumes a part of the CPU processing time).
0.0%st
***have to be aware of is:
1) When the id continues to be too low, there is an urgent need to solve the CPU resource problem;
2) When the wa usage rate is too high, consider whether there is a bottleneck in io performance;
3) When the hi usage rate is too high, it means that the current hardware interruption takes up a large percentage;
  • Memory information
Detailed information of each field in the memory information
 
MEM
404572k  total
Total physical memory
286456k  used
Total physical memory used
208116k  free
Total free physical memory
34772k    buffers
Total amount of memory used as cache
SWAP
4095992k  total
Total swap area memory
0k    used
Total swap area used
4095992k  free
Total free swap area
75588k     cached
Total memory of buffered swap area
The memory can be monitored through the free command; drop cache can release the buffer and cache memory
*** Several important formulas:
Total physical memory: Mem_total = Mem_used + Mem_free
Actual physical memory used: -buffers / cache = used-buffers-cache
Actual available physical memory: + buffers / cache = free + buffers + cache
Total memory corresponding to swap partition: Swap_total = swap_used + swap_free
  • Process information
PID: process ID, the unique identifier of the process
USER: The actual user name of the process owner.
PR: The scheduling priority of the process. Some values ​​in this field are 'rt'. This means that these processes are running in real time.
NI: Nice value (priority) of the process. A smaller value means a higher priority. Negative values ​​indicate high priority, positive values ​​indicate low priority
VIRT: Virtual memory used by the process. The total amount of virtual memory used by the process, in kb. VIRT = SWAP + RES
RES: Resident memory size. Resident memory is the size of non-swappable physical memory used by the task. The size of the physical memory used by the process that has not been swapped out, in kb. RES = CODE + DATA
SHR: SHR is the shared memory used by the process. Shared memory size, unit kb
S: This is the state of the process. It has the following different values:
D-Uninterruptible sleep state.
R-Running state
S-sleep state
T-being tracked or stopped
Z-Zombie
% CPU: the percentage of CPU time used by the task since the last update to the present, which represents the percentage of CPU occupied by the process, through which the CPU utilization of the process can be obtained;
% MEM: The percentage of available physical memory used by the process.
TIME +: The total CPU time used until the task is started up to one hundredth of a second.
COMMAND: The command used to run the process. Process name (command name / command line)
There are also many outputs that are not displayed by default, they can show the page fault of the process, the effective group and group ID, and other more information.

Other tips for using top
  • Interval refresh: top + keyboard "d";
  • Add the display column of the process field: top + keyboard "f", select the corresponding letter in the pop-up list to display the column corresponding to the letter;
  • Save configuration: top + "W";
 
 
 
Published 22 original articles · praised 5 · visits 1040

Guess you like

Origin blog.csdn.net/weixin_37018468/article/details/105297120