Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Commonly used machine performance evaluation tools

2025-02-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Yang Haichun, who once served as the main design and development post in Congxing Technology Co., Ltd., is familiar with the overall system architecture of mobile billing system. Currently working in Tencent computer Systems Co., Ltd., as an engineer, familiar with log billing system, offline computing and other scenarios.

The software system runs on the machine, and the processing capacity is restricted by hardware, so there will be an upper limit on the processing capacity of a single machine. Evaluate the upper limit of the processing capacity of the machine and check where the bottleneck of the program is, which is helpful to the analysis of program performance.

Major hardware: CPU, memory, network, disk. This paper mainly introduces the performance evaluation tools of these major hardware based on my experience.

1.CPU performance Evaluation 1.1 example of vmstat tool use: vmstat 1 10

First parameter: sampling frequency

Second parameter: sampling times

Result parameters:

-- procs--

R: the number of processes running and waiting for CPU time slices

B: the number of processes waiting for the resource. For example, wait for the network I am O

If the r value is greater than the number of CPU for a long time, CPU encounters a bottleneck

-- cpu--

Us: percentage of CPU time consumed by user processes

Sy: percentage of CPU time consumed by kernel processes

As in the picture above, after running a few programs that consume cpu, I found that us has been running full for a long time. At this point, you may need to consider optimizing the application service algorithm.

General: if the us for a long time is greater than 50, you need to consider the optimization program algorithm and so on.

Sy + us > 80 may have CPU bottleneck.

1.2 Sar tools

For example: sar-u 1 5

The% idle value is high, indicating that CPU is idle.

If the idle value persists below 10, the current bottleneck in the system is CPU.

As pictured above, CPU has reached a bottleneck.

2. Memory performance Assessment 2.1 free tool

Example: free-g or free-m

-g: view in GB

-m: view in MB

Follow the second line:

-buffers/cache= memline: used-buffers-cached

+ buffers/cache= memline: free+buffers+cached

Generally, the second line + buffers/cache indicates the memory available to the application.

The content in cached can generally be released to the application.

Free the memory in the cached to see if it is available:

Echo 3 > / proc/sys/vm/drop_caches

Check the memory again:

It was found that in the end, it was completely released, and only part of it was released. (compared with the picture above)

Check: it is found that some of the shared memory is occupied and cannot be released, so the application cannot use this part.

Delete shared memory that is not currently in use:

Ipcs-m | awk'$6 = = 0 {system ("ipcrm-m" $2)}'

Re-execution

Echo 3 > / proc/sys/vm/drop_caches

Re-execution

Free-m

Some of the memory in cached has been freed.

The rest, part of the shared memory, the normal use of the application, can not be released.

Therefore, the real available memory should be about 2400m.

You can also use cat / proc/meminfo to view

3. Disk performance Assessment 3.1 iostat tool

For example:

Iostat-d-x-k 1 10

-d indicates that the device (disk) usage status is displayed

-x will be used to display extended data related to io

-k some columns that use block force the use of Kilobytes as unit

The average wait time for await I Pot O requests (in milliseconds); the smaller the value, the better the performance.

Average service time (in milliseconds) for svctm IPUBO requests

% of the time spent on the util O operation. Close to 100, indicating that the disk is running at nearly full capacity.

As shown in the figure above, if the await time is much longer than the svctm, it means that the waiting time for the Imax O queue is too large and the disk has reached the bottleneck.

3.2 Sar tool

For example:

Sar-d 1 10

Avwait: the average time that a delivery request waits for the queue to be idle when the queue is full.

Avserv: the average time (in milliseconds) it takes to complete the delivery request.

% util: 100disk is already busy.

Look at the write speed, more than 100 M per second. To improve the writing speed, you can change to a faster disk.

4. Network card performance monitoring 4.1 ss tools

For example:

Ss-a-tp-s | grep agent

Ss-s

View the number of existing connections, etc.:

Common options:

-a shows all sockets

-l shows what is being monitored

-n displays the digital IP and port, not through the domain name server

-p displays the corresponding programs that use socket

-s prints out statistics.

5. Overall performance Evaluation tool 5.1 Top tool

For example:

Top

% us: refers to the time that cpu spends on user-mode programs

% sy: refers to the time spent on kernel state programs by cpu

% ni: refers to the time spent on nice priority adjusted user-mode programs

% id: refers to cpu idle time

Load average:

Average length of the task queue

Average from 1 minute, 5 minutes, 15 minutes ago to now

If the three values are greater than the CPU core for a long time, the machine is busy. There are 8 consumptive CPU programs in the figure above, and it can be found that the average number of CPU in one minute has passed (the number of machine CPU is 8 cores).

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report