Ultra-fine finishing, performance test-performance index monitoring command detailed actual combat, a speed pass


foreword

Performance monitoring command: MEMORY

First of all, let’s talk about virtual memory and physical memory:
virtual memory is to use hard disk to expand physical memory, and write temporarily unused memory pages to hard disk to free up more physical memory for processes that need it.

When these memory pages need to be used, they are read back from the hard disk to memory. All this is transparent to the user. Usually in the Linux system, the virtual memory is the swap partition.

On x86 systems virtual memory is divided into pages of 4K in size.

When each process starts, it will apply for virtual memory (VSZ) from the system, and the kernel agrees or rejects the request. When the program actually uses memory, the system maps it to physical memory. RSS indicates the size of the physical memory occupied by the program. With the ps command we can see the VSZ and RSS occupied by the process.

A1

Use the "Free" command on the command line to monitor memory usage

A2

The meaning of the output

A3

top:
You can directly use the top command to view the content of %MEM. You can choose to view by process or by user. If you want to view the process memory usage of the oracle user, you can use the following command:

pmap:

pmap -d 1878

ps:

ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid'

where rsz is the actual memory

ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep root| sort -nrk5

Find the cpu consumption of specific processes:

ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' | grep 16685

A4

According to the above information analysis, the Java process with process ID 16685 is running, and its CPU usage is 2.0%. Its physical memory footprint is 2347976KB (2296M), and its virtual memory footprint is 5751812KB (5616M).

Find the top 10 processes consuming the most memory:

ps -auxf | sort -nr -k 4 | head -10

Performance Monitoring Command | IO and NETWORK


The common command for IO monitoring IO is iostat

iostat -x

A5

The meaning of io-related parameters

A6

Remarks:
Focus on: rkB/s wkB/s two indicators (read speed per s: 103.88 write speed per s: 70.81)

Performance Monitoring Commands | CPU

Cpu risk diagnosis
1. Cpu key performance indicators
CPU load;
CPU utilization;

CPU utilization. When %CPU ≥ 50%, you need to pay attention; when %CPU ≥ 70%, you need to pay close attention. If it is a test, you need to analyze the reason at this time;

When %CPU≥90%, it is in a dangerous state. This state should not become a normal state, and the reason must be analyzed during the test.

Load (load average), when the load average > CPU core number 1, the workload is already relatively heavy, and the cause needs to be analyzed; when the load average > CPU core number 2, the load is already high, and the cause needs to be checked.

2. Positioning method
The following method is used to analyze the CPU performance problem.
Find the process with high CPU utilization;
find the thread that occupies the most CPU in this process;
get the stack information of the current thread (thread snapshot);
analyze the program execution process;

Case:
Simulate a scenario where the CPU usage rate is 100%: stress --cpu 1 – timeout 600;
command line, enter top and press 1 to find the largest process in Linux;

A7

Find the PID of the largest process as the 5649
command line, top –Hp 5649 find the threads that occupy the most CPU in this process (if any, such as in the JVM)

A8

Get the stack information of the current thread jstack -l PID >./log and export

Other commands:
ps:
Find out the top 10 processes using the most CPU:

ps -auxf | sort -nr -k 3 | head -10

uptime: View the average load of the system, the watch -d parameter indicates the highlighted area of ​​change: watch -d uptime

mpstat View changes in CPU usage: mpstat -P ALL 5

The following is the most complete software test engineer learning knowledge architecture system diagram in 2023 that I compiled

1. From entry to mastery of Python programming

Please add a picture description

2. Interface automation project actual combat

Please add a picture description

3. Actual Combat of Web Automation Project

Please add a picture description

4. Actual Combat of App Automation Project

Please add a picture description

5. Resume of first-tier manufacturers

Please add a picture description

6. Test and develop DevOps system

Please add a picture description

7. Commonly used automated testing tools

Please add a picture description

Eight, JMeter performance test

Please add a picture description

9. Summary (little surprise at the end)

Only by doing your best can you meet greater challenges; only by striving hard can you write a brilliant chapter; as long as you don't give up, success is waiting for you ahead. Adhere to the dream, go forward bravely, the future road is wonderful because of you!

Only by doing our best can we light up the stars in the future; only by persevering can we usher in the dawn of success. No matter how many setbacks you encounter, keep fighting, you are an invincible rocket, and you will always fly forward!

As long as there is a dream, there are infinite possibilities; as long as there is persistence, miracles can be created; set sail, forge ahead, go forward bravely, victory belongs to those who are not afraid of hardships and dare to fight. Believe in yourself and work hard, you will reap a bright future!

Guess you like

Origin blog.csdn.net/shuang_waiwai/article/details/131750917