Overview
I saw an article explaining VU, RPS, RT today, and there is a formula in the middle as shown below
Concurrent number = RPS * Response time
So I did several experiments locally to try to verify the accuracy of the formula
Experimental website www.baidu.com
First experiment span>
100 threads, one iteration, startup time 1s, thread group and aggregate report as shown in the figure span>
It can be seen from the results , 100 concurrency/s, one iteration Generation, the average response time is 68ms
If you look at the above formula
RPS = Concurrent number/Response time = 100/0.068, which is approximately 1470/S< /p>
But we can see in the thread group that the preset RPS is 100/S
The gap is a bit big~~~Think about why?
Second Experiment
100 threads, continuous iteration, start the thread within 1s, and continue to run for 10s. The thread group and aggregation report are shown in the figure.
< /p>
It can be seen from the aggregate report that the average TPS=1303. So can we just assume that TPS=RPS?
Just do a simple calculation.
The figure shows that our single response time is 72ms, so we can iterate approximately 14 times in 1 second. With 100 threads, approximately 1400 requests can be sent in one second.
So our RPS is approximately 1400/S strong>
So you can see it, send 1400 times in one second Request, but only 1300 requests can be responded within 1s
Let’s reverse verify the number of concurrent attempts
span>
Concurrent number = RPS*response time, 1400* 0.072 is equal to 100.8 ,It is almost the same as the number of concurrency set in the thread group.
If we use Throughput=RPS to reverse verification< /span>
Concurrent number = RPS*response time, 1303* 0.072 is equal to 93, There is some gap between the number of concurrency and the number of concurrency set in the thread group.
The conclusion of these two experiments: Under continuous iteration, due to sufficient samples, the formula holds. But RPS! = TPS
third experiment
This time we directly add the RPS timer to verify the formula through accurate RPS
We keep 200RPS for 1 minute and check the aggregate report
First of all, we can see that at 200RPS, the average TPS is only 172!
Secondly, the average number of concurrency = 200*0.047 = 9.4 means I only need 9 threads , You can release the pressure of 200RPS in one second
Can calculate each thread per second The number of requests is 200/9.4 =21, which means that a thread can iterate up to 21 times per second
Reverse the response time of each request is about 1000/21, about 47ms
The results of the verification before and after all match!
The fourth experiment
This time we directly set the average concurrency value obtained under 20RPS in the thread group 9, and infer the accuracy of RPS in the reverse direction
< /p>
Calculate RPS = 9 /0.043 which is approximately equal to 209
Because the thread group can only be set to integers, there will be some errors from Experiment 3, which will not affect the accuracy of the test
Concluding remarks: Judging from the results of several experiments, with sufficient samples, the formula is no problem. The point is to keep a doubtful heart at all times when doing tests, and don’t blindly believe in any authority!