How to analyze problems, find performance bottlenecks, and master performance tuning? An article to understand performance testing

background

Under the current background of cloud computing and big data prevailing, the demand for large concurrency and large throughput is already a problem in front of enterprises. Among them, the performance requirements of the network are particularly critical. In addition to the performance requirements of the software itself, some hardware The above optimization is also essential.

As a tester, you are certainly no stranger to performance testing issues, but testing is not just about executing and collecting data, but more about analyzing problems, finding performance bottlenecks, and doing some optimization work.

After all, when the customer is testing the performance on site, it is undoubtedly a icing on the cake to improve the performance of the software through some system-level tuning.

index

No matter what kind of performance testing you do, indicators cannot be bypassed. Indicators are an important basis for quantitative performance testing. There are many indicators to measure a certain performance. For example, TPS, QPS and delay are usually used to measure database performance, and iops, throughput and delay are usually used to measure IO performance. There are also many performance indicators to measure network performance. There is a RFC2544 standard in the industry , reference link: https://www.rfc-editor.org/rfc/rfc2544.

Here are a few indicators explained a little:

Back-to-back test: within a period of time, the amount of data when sending fixed-length packets continuously on the transmission medium at the legal minimum frame interval without causing packet loss.

Packet loss rate test: Under the steady load state of the router, the percentage of frames that cannot be forwarded due to lack of resources to all frames that should be forwarded.

Latency test: the time interval from when the last bit of the input frame arrives at the input port to when the first bit of the output frame appears at the output end.

Throughput test: the maximum rate that can be forwarded without packet loss.

Usually, customers are more concerned about the indicators of throughput and delay. Throughput reflects the concurrent processing capability of the system, and delay reflects the response time of the overall business.

test preparation

This article takes the fighter intel X710 in the network card as the test object, and conducts the throughput test of small packets.

Tips: Generally, the test of large packets can reach the line speed, but the test of small packets is difficult. Under the same mtu, the smaller the packet, the more packets the CPU can process per unit time, and the greater the pressure on the CPU.

test topology

Insert the X710 network card into the device under test, use the two network ports of the network card to build a linux bridge, and send and receive data packets through the tester:

[root@localhost~]#brctl addbr test

[root@localhost~]#brctl addif test enp11s0f2 enp11s0f3

[root@localhost~]#ip link set test up

[root@localhost~]#brctl show

bridge name bridge id STP enabled interfaces

test 8000.6cb311618c30 no enp11s0f2

enp11s0f3

virbr0 8000.5254004c4831 yes virbr0-nic

3.2 Hardware information

A great man once said, "If performance testing doesn't talk about hardware, then it's the same reason as love but not marriage. They are all hooligans."

Lu Xun: "I didn't say that!" As an aside, let me briefly talk about the process after the data packet enters the network card: after the data packet enters the network card, the data is cached in the server memory and the kernel is notified to process it, and then the protocol stack is processed. Usually netfilter is also processed in the protocol stack, and finally the application reads data from the socker buff.

To be honest, the test in this article uses the domestic Light Phytium S2500 server.

4. Test tuning

For the above topology, send 128 bytes of 10 Gigabit bidirectional traffic, and use the RFC2544 standard for testing.

The standard of RFC2544 is 0 packet loss test throughput, the result is 818Mbps

The above are the appetizers, and the next step is the highlight of this article. Do some optimization based on the existing resources to improve the "test" performance and satisfy customers.

4.1 Adjust the number of queues

Adjust the number of queues of the network card, and use the multi-queue feature of the network card. Different queues are bound to different CPUs through interrupts to improve CPU processing performance and network bandwidth.

Adjust the number of queues. The bigger the better, because the number of CPUs in the server has an upper limit. If there are too many queues, multiple interrupts will be bound to the same CPU. Here, a single numa server has 8 CPUs. Modify the queue The number is 8.

[root@localhost~]#ethtool-l enp11s0f2

Channel parameters for enp11s0f2:

Pre-set maximums:

RX:0

TX:0

Other:1

Combined:128

Current hardware settings:

RX:0

TX:0

Other:1

Combined:8

Because the data packet will enter multiple packet receiving queues according to the hash, when sending the data packet, you can select the flow with the source IP change to ensure that the multi-queue of the network card is used, and you can check the queue count of the network card.

……

Due to the author's copyright requirements, only a part of the article is displayed. If you want to read the full version of the article, you can private message me.

at last:

You can go to my personal account: atstudy-js, and you can get a copy of the 10G software test engineer interview collection document for free. And the corresponding video learning tutorials are free to share! These include basic knowledge, Linux essentials, Mysql database, packet capture tools, interface testing tools, advanced testing-Python programming, Web automated testing, APP automated testing, interface automated testing, continuous integration testing, testing framework development testing framework , performance testing, etc.

These test materials should be the most comprehensive and complete preparation warehouse for friends who do [software testing]. This warehouse has also accompanied me through the most difficult journey, and I hope it can help you too!

Guess you like

Origin blog.csdn.net/deerxiaoluaa/article/details/131192859