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

Analysis of key performance Indexes of Server in performance Test

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Many novices are not very clear about how to analyze the key performance indicators of the server in the performance test. in order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

When testing the service-side performance of Internet services, we mainly focus on two aspects of performance indicators:

Business indicators: such as throughput (QPS, TPS), response time (RT), number of concurrency, business success rate, etc.

Resource metrics: consumption of resources such as CPU, memory, Disk I Zero, Network I Zero, etc.

The following mainly introduces some widely applicable and basic resource indicators and how to obtain these indicators in the Linux server.

With regard to CPU resources, there are three important concepts that we need to focus on: utilization, run queues, and context switching.

CPU usage (CPU Utilization Percentages): the time the process spent in the Running state / total time.

In the performance test metrics, CPU utilization is usually calculated by us + sy, and the acceptable upper limit is usually 70%-80%. In addition, it should be noted that during the testing process, if the value of sy is more than 25% for a long time, you should pay attention to the values of in (system interrupt) and cs (context switching), and analyze whether it is reasonable according to the implementation logic of the application under test.

Running queue processes (Processes on run queue): the number of processes in Running status + Waiting status, which shows the number of tasks running and waiting for CPU resources. It can be regarded as a work list of CPU, and is an important basis for judging whether CPU resources have become a bottleneck. Vmstat is reflected by the value of r:

R: the number of runnable processes, including those that are running (Running) and those that are ready to run (Waiting).

If the value of r is equal to the total number of cores of the system CPU, the CPU is at full load. In load testing, the acceptable upper limit is usually no more than 2 times the number of CPU cores.

Context switching (Context Switches): to put it simply, context refers to the contents of CPU registers and program counters at a certain point in time. Context switching means that kernel suspends a process and stores the state of the process at this time in memory, and then restores the original state of the next process to be executed from memory to the register. from its last suspended execution code to frequent context switching will lead to the increase of sy value. Vmstat is reflected by the value of cs:

Another indicator is used as a reference for the load of the system over a period of time:

Average load Load Average: in UNIX systems, Load is a measure of system workload. There are two kinds of Load values. Most UNIX systems take the value of the running queue (r of vmstat output), while Linux systems take the value of running queue + the number of processes in task_uninterruptible state (b of vmstat output), so there will be cases of low CPU utilization but high load value. Load Average is the average load over a period of time. System tools such as top, uptime, and so on provide average load values of 1 minute, 5 minutes, and 15 minutes.

The memory mentioned, including physical memory and virtual memory, the performance testing tool physical memory and a piece of space on the hard disk (SWAP) are combined as virtual memory (Virtual Memory) to provide a continuous memory space for the process to run. The advantage is that the memory available to the process becomes larger, but it should be noted that the read and write speed of SWAP is much lower than that of physical memory. And the data exchange between physical memory and swap will increase the burden on the system. Virtual memory is divided into pages (the default page size of x86 system is 4k), and the kernel reads and writes virtual memory in pages. When the physical memory space is insufficient, memory scheduling will store the rarely used page data on physical memory to the SWAP space of disk. The process of data exchange between physical memory and swap space is called page exchange (Paging).

Available memory (free memory): the intuitive data consumed by memory, the value of free output by vmstat. Too small available memory will affect the running efficiency of the whole system. For stable systems, the acceptable range of free should be greater than 20% of physical memory, that is, memory footprint should be less than 80% of physical memory. In the stress test, the situation of the system memory resources should be judged by the available memory combined with page swapping. If there is little memory but little page swapping, it can be considered that the memory resources also have a serious impact on the system performance.

Page swapping (Paging): page swapping includes swapping from SWAP to memory and from memory to SWAP, which should be noted if frequent page swaps occur in the system. It can be obtained from vmstat's si and so:

Si: the size of data read from SWAP to memory per second

So: the size of data written from memory to SWAP per second

SWAP space usage: the current SWAP space usage can be obtained from vmstat's swpd, which should be analyzed in combination with page swapping. For example, when swpd is not 0 but si,so remains at 0, memory resources do not become the bottleneck of the system.

Disk is usually the slowest link in the system, one is its own slow speed, even for SSD, there is still an order of magnitude gap between its reading and writing speed and memory, and the other is that it is farthest from CPU. In addition, it should be noted that disk IO is divided into two types: random IO and sequential IO. In the performance test, we should first know which type of system under test is biased.

Random IO: random read and write data, there are many read and write requests, the amount of data per read and write is small, and its IO speed is more dependent on the number of disk IO per second (IOPS).

Sequential IO: sequential requests for a large amount of data, a relatively small number of read and write requests, a large amount of data per read and write, and sequential IO pays more attention to the data throughput of each IO.

For disks, the primary concern is utilization, IOPS, and data throughput, which can be obtained using iostat in the Linux service area.

(device) usage: the percentage of time it takes to process I util O requests in the statistical process, that is, the% util in the output of iostat. If this value is greater than 60%, it is likely to degrade the performance of the system.

IOPS: the number of read / write requests processed per second, that is, the number of read / write requests per second in iostat output, the IOPS of the mechanical hard disk of personal PC is generally around 100, while the average server of various public / private clouds is only in the order of one hundred. Get the IOPS capability of the service area in advance, and then monitor the IOPS data in the performance test to measure whether the current disk can meet the IO requirements of the system.

Data throughput: the data size of read / write per second, that is, rkB/s and wkB/s in iostat output. Usually, the data throughput of disk is directly related to the type of IO. The throughput of sequential IO is obviously better than that of random read and write. The throughput of disk under random IO and sequential IO can be measured in advance, so that the monitored data during testing can be compared and measured.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report