从 Jmeter jtl 日志文件计算吞吐量
我试图找出一个公式来计算吞吐量(请求数/时间单位),该公式基于 jtl 日志中的一些属性,基于以下参数:
- 时间戳 (ts)
- 时间 (t)
- 总请求数
看一下时间戳我不完全确定它是指发送请求的时间还是收到响应的时间(这里是我的主要困惑点)。看一下这些值,第一个选项似乎更有可能。因此,假设这一点,我得出以下结论:
Throughput = (NumRequests / (max(ts + t) - min(ts)) ) * 1000
谁能告诉我我的观点是否正确?
更新(并感谢 @BlackGaff 的回复)
要点是我需要在非 GUI 环境中执行测试并收集某些自动化流程的结果,因此我无法真正使用聚合报告(除非有办法从命令行运行它)。使用 max & min 尝试从一组请求中查找 ts 值(在同一测试中)。另外,如果我将采样器配置为具有不同于 0 的上升周期(因此负载是分布式的),则我得到的 ts 数字是不同的。是的,正如您之前提到的,我实际上正在寻找第一个样本的开始时间和最后一个样本的结束时间之间的差异。除此之外,我在 jmeter.properties 中找到了一个参数:
# Put the start time stamp in logs instead of the end
#sampleresult.timestamp.start=true
所以根据这个参数,我似乎还应该更改计算以获取开始和结束时间。
注意:我很好奇如何根据 jtl 文件计算此值,但如果有人需要从命令行获取这些数字,请尝试添加“生成摘要报告”侦听器,在 jmeter 日志中,您将得到类似于以下内容的行执行结束时出现以下内容:
2011/03/10 22:31:42 INFO - jmeter.reporters.Summariser: Generate Summary Results = 200 in 9.8s = 20.5/s Avg: 95 Min: 75 Max: 315 Err: 0 (0.00%)
I was trying to come out with a formula to calculate the throughput (number requests/time unit) based on some properties from the jtl log based on the following parameters:
- Timestamp (ts)
- Time (t)
- Number of total requests
Taking a look at the timestamps I was not completely sure if it refers to the time when the request was sent or when it received the response (my main point of confusion here). Taking a look at the values the first options seems more likely. So assuming this, I've come out with the following:
Throughput = (NumRequests / (max(ts + t) - min(ts)) ) * 1000
Can anyone tell me if I'm right with this?
Update (and thanks for the response @BlackGaff )
The point is that I need to execute my tests and gather the results in a non-gui environment for some automated processes, so I can't really use the Aggregate Report (unless there is a way to run it from the command line). The use of max & min is an attempt to find the ts values from a set of requests (within the same test). Also, if I configure the samplers to have a ramp up period different than 0 (so the load is distributed), the numbers I get for ts are different. And yes, as you already mentioned before, I'm effectively looking for the difference between startTime of the first sample and endTime of the last sample. Apart from that I found a parameter in jmeter.properties:
# Put the start time stamp in logs instead of the end
#sampleresult.timestamp.start=true
So depending on this parameter it seems I should also change the calculation to get the start and end times.
NOTE: I'm curious about how to calculate this based on the jtl file but if anyone needs to get these numbers from the command line try adding the "Generate Summary Report" listener, and in the jmeter logs you will get a line similar to the following at the end of the execution:
2011/03/10 22:31:42 INFO - jmeter.reporters.Summariser: Generate Summary Results = 200 in 9.8s = 20.5/s Avg: 95 Min: 75 Max: 315 Err: 0 (0.00%)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Jmeter 的聚合报告中打开 JTL 日志是否会更容易,该报告将为您计算吞吐量,然后将其保存回来?
但是,就问题而言。
目前,您的公式具有时间/请求单位。考虑到您想要请求/时间,公式应为:
我不完全确定为什么要使用最大值和最小值,因为您只提供一个值,而这些函数从一组返回最大值/最小值。鉴于 TS 是相同的值,使用 EXCEL,您最终会得到:
我相信您真正想要的是第一个样本的 startTime 和最后一个样本的 endTime 之间的差异)
根据术语表:
给出最终公式:
Might it be easier to open the JTL log in Jmeter's Aggregate report, which will calculate the Throughput for you, and then save it back out?
But, on point with the question.
Currently, your formula has units of time / requests. Given you want requests/time, you the formula should read:
I'm not entirely sure why you're using max and min, since you're only providing one value and those functions return the max/min from a set. Given that TS is the same value, using EXCEL, you end up with:
I believe what you really want is the difference between startTime of the first sample and endTime of the last sample)
Per the glossary:
Giving a final formula of:
有。您可以使用 JMeter 插件项目中的 CMD 工具生成 CSV 格式的聚合报告。
http://jmeter-plugins.org/wiki/JMeterPluginsCMD/
There is. You can use CMD tool from JMeter Plugins project to generate Aggregate report in CSVs.
http://jmeter-plugins.org/wiki/JMeterPluginsCMD/
假设您要计算 20 个线程的吞吐量。以下是要遵循的步骤:
使用以下命令从时间戳获取小时分钟秒
运行以下命令以获取吞吐量/秒
Assuming the you want to calculate the throughput at 20 threads. Following are the steps to follow:
Get the hour min sec from the time stamp using following command
Run following command to get throughput / sec