Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current RPS is not accurate #149

Open
debugtalk opened this issue Dec 1, 2021 · 2 comments
Open

current RPS is not accurate #149

debugtalk opened this issue Dec 1, 2021 · 2 comments

Comments

@debugtalk
Copy link
Contributor

Describe the bug

When running in standalone mode, the ConsoleOutput will print each (method, name) group's current RPS. And I found that the data is not accurate. The report interval is 3s, the requests number of get with params is 20, the rps should be 20/3=6.67, which is much bigger than the actual 5.

Current time: 2021/12/01 12:06:26, Users: 10, Total RPS: 15, Total Fail Ratio: 0.0%
+--------------+-----------------+------------+---------+--------+---------+-----+------+--------------+------------+-------------+
|     TYPE     |      NAME       | # REQUESTS | # FAILS | MEDIAN | AVERAGE | MIN | MAX  | CONTENT SIZE | # REQS/SEC | # FAILS/SEC |
+--------------+-----------------+------------+---------+--------+---------+-----+------+--------------+------------+-------------+
| request-GET  | get with params |         20 |       0 |    970 |  977.15 | 954 | 1089 |          300 |          5 |           0 |
| request-POST | post json data  |         20 |       0 |    250 |  244.70 | 238 |  251 |          420 |          5 |           0 |
| request-POST | post form data  |         20 |       0 |    250 |  245.20 | 240 |  253 |          441 |          5 |           0 |
+--------------+-----------------+------------+---------+--------+---------+-----+------+--------------+------------+-------------+

This issue maybe resulted from the algorithm of calculating current rps. As the keys of numReqsPerSecond is timestamps, while mostly the interval may span 4 seconds, e.g. starts from 0.5s and ends at 3.5s.

func getCurrentRps(numRequests int64, numReqsPerSecond map[int64]int64) (currentRps int64) {
	currentRps = int64(0)
	numReqsPerSecondLength := int64(len(numReqsPerSecond))
	if numReqsPerSecondLength != 0 {
		currentRps = numRequests / numReqsPerSecondLength
	}
	return currentRps
}
@MyNextWeekend
Copy link
Contributor

看起来可以把 slaveReportInterval 传给 output ,用于计算 CurrentRps 。不知是否可以提pr

@myzhan
Copy link
Owner

myzhan commented Sep 14, 2023

@MyNextWeekend 不太清楚你要怎么实现,可以先提 PR 看看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants