This article is for the blogger to study notes, the content comes from the Internet, if there is infringement, please contact delete.

Personal Note: github.com/dbses/TechN…

01 what is the performance test?

Performance testing should have metrics

Time indicators, capacity indicators, and resource usage indicators.

Have a model for performance testing

Business model, for example, we have 100 kinds of business, only 50 business need to have concurrency, it is necessary to count these concurrent business, which business has more concurrency, which business has less concurrency, the stress test should control the proportion.

Monitoring model, the monitoring of this part, must have the ability of stratification, segmentation, global monitoring, directional monitoring.

Have a plan for performance testing

There are several key points in the content stipulated in the plan, namely, test environment, test data, test model, performance indicators, stress policy, access approval and schedule risk.

Performance testing should have predetermined conditions

The conditions include software and hardware environment, test data, test execution strategy, pressure compensation, etc. By extension, these conditions should be determined before the scenario is executed.

Have scenarios in performance testing

  1. Baseline Performance Scenario
  2. Capacity Performance Scenario
  3. Stability performance scenario
  4. Abnormal Performance Scenario

Analytical tuning is part of performance testing

Performance items fall into the following categories:

  • New system performance test class

    Such projects typically require testing the maximum capacity of the system.

  • Old system new version performance test class

    As long as the performance does not deteriorate, you can calculate the capacity based on historical data.

  • New system performance test optimization class

    Such systems are not only tested to maximum capacity, but also tuned to maximum capacity.

The responsibilities of the performance team are as follows:

  1. Performance verification
  2. The performance test
  3. Performance testing + analysis tuning

The results of performance tests should be reported

Include TPS, response time, and resource comparison charts in the report.

02 | what is the relationship between TPS and response time?

In the figure above, the blue line represents TPS and the yellow line represents response time.

In the process of TPS increase, the response time will be in A low state at the beginning, that is, before point A.

Then the response time starts to increase somewhat until the business can afford point B, where TPS still has room to grow.

The pressure is then increased until the maximum TPS is reached at point C. We increase the pressure further, the response time increases, but the TPS decreases.

It is not inevitable that some systems will do well on the queue, maintain a stable TPS, and any additional requests will be kindly rejected.

Finally, the response time after point D is too long, reaching the point of timeout.

In actual performance testing, both the baseline and capacity performance scenarios need to be incremental, rather than starting with hundreds or thousands of threads. At the same time, increments should be continuous, rather than a 100 thread, 200 thread, 300 thread disconnected execution scenario.

Why are performance scenarios continuous? Rather than disconnect?

Increasing the number of threads can record each performance indicator, draw a curve for comparative analysis, to observe the trend of indicator change, find out the performance bottleneck and the maximum processing capacity of the server.

03 | system performance indicators have?

Performance indicator notation commonly used in the performance testing industry.

shorthand English full name meaning
RT Response Time Response time. Response Time usually includes Request Time and Response Time.
HPS Hits Per Second Hits per second
TPS Transactions Per Second Transactions per second
QPS Queries Per Second In MySQL, the number of SQL statements per second
RPS Requests Per Second Requests per second
CPS Codes Per Second CPS is occasionally referred to in the HTTP protocol as HTTP return codes per second.
PV Page View Page views
UV Unique Visitor Unique visitor
IP Internet Protocol The original value is an IP address, which generally refers to the number of independent IP addresses
Throughput / throughput
IOPS Input/Output Operations Per Second Usually describes disks

TPS

TPS is a key performance metric concept in the field of performance. It is used to describe the number of transactions per second, which can reflect the processing power of a system. The granularity of TPS definitions varies from industry to industry and business to business. So wherever you use TPS, there must be a precondition that everyone involved knows how your T is defined.

Here are some examples:

If we were to test interfaces 1, 2, and 3 separately, then T would be interface level; If we want to place an order from the user’s point of view, then 1, 2, and 3 should be in a T, which is business level.

RPS

If a user clicks once, sends three HTTP requests, invokes two order services, two inventory services, and one credit service, how does this Request count?

If you want to describe the whole, you have at most three RPS. If understood from the perspective of HTTP protocol, then HTTP Request is a relatively accurate description, but its definition does not include services. If you give it a business meaning, you can use it to describe performance.

Number of threads in the stress tool (number of users) and TPS

The concept of “concurrency” requires specific metrics.

You could say, my concurrency is 1,000 TPS, or 1,000 RPS, or 1,000 HPS. But you can’t say concurrent 1000 without units.

The following figure illustrates the number of threads versus TPS.

The figure above has four concurrent threads, each of which can complete four transactions in a second, so the total TPS is 16.

So how do we define the number of users? If a system has 10,000 users online, concurrency in many services will be less than 5%, or even less than 1%. If you take 5%, that’s just 5%


10000 The user 5 % = 500 ( T P S ) 10000 users * 5\%=500(TPS)

Note that this is TPS and not the number of concurrent threads. If the response time is 100ms, then obviously the number of concurrent threads is


500 T P S / ( 1000 m s / 100 m s ) = 50 ( Concurrent threads ) 500TPS/(1000ms / 100ms)=50(concurrent threads)

Using this simple calculation logic, we can see the relationship between the number of users, the number of threads, and TPS.