从 Jmeter jtl 日志文件计算吞吐量 [英] Calculating throughput from Jmeter jtl log file

查看:25
本文介绍了从 Jmeter jtl 日志文件计算吞吐量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图根据 jtl 日志中的一些属性,根据以下参数计算吞吐量(请求数/时间单位)的公式:

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:

  • 时间戳 (ts)
  • 时间 (t)
  • 请求总数

查看时间戳,我不确定它是指发送请求的时间还是收到响应的时间(我在这里的主要困惑点).看看第一个选项的值似乎更有可能.因此,假设这一点,我得出了以下结论:

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?

更新(感谢@BlackGaff 的回复)

关键是我需要在非 gui 环境中为一些自动化进程执行我的测试并收集结果,所以我不能真正使用聚合报告(除非有一种方法可以从命令中运行它)线).max & 的使用min 试图从一组请求(在同一测试中)中找到 ts 值.此外,如果我将采样器配置为具有不同于 0 的上升周期(因此负载是分布的),则我获得的 ts 数字是不同的.是的,正如您之前已经提到的,我正在有效地寻找第一个样本的 startTime 和最后一个样本的 endTime 之间的差异.除此之外,我在 jmeter.properties 中找到了一个参数:

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.

注意:我很好奇如何根据 jtl 文件计算它,但如果有人需要从命令行获取这些数字,请尝试添加生成摘要报告"侦听器,在 jmeter 日志中,您将获得一个执行结束时类似于以下的行:

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%)

推荐答案

在 Jmeter 的 Aggregate 报告中打开 JTL 日志会更容易,它会为您计算吞吐量,然后将其保存回来?

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?

但是,关于这个问题.

目前,您的公式具有时间/请求单位.鉴于您想要请求/时间,您的公式应为:

Currently, your formula has units of time / requests. Given you want requests/time, you the formula should read:

Throughput = (NumRequests / (max(ts + t) - min(ts) ) ) * 1000

我不完全确定您为什么使用 max 和 min,因为您只提供一个值,而这些函数从一组返回最大值/最小值.鉴于 TS 是相同的值,使用 EXCEL,你最终得到:

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:

Throughput = (NumRequests/t*1000)

我相信你真正想要的是第一个样本的 startTime 和最后一个样本的 endTime 之间的差异)

I believe what you really want is the difference between startTime of the first sample and endTime of the last sample)

根据词汇表:

吞吐量计算为请求/时间单位.现在的时间是从第一个开始计算采样到最后一个采样结束.这包括之间的任何间隔样品,因为它应该代表服务器上的负载.这公式为:吞吐量=(数量请求)/(总时间).

Throughput is calculated as requests/unit of time. The time is calculated from the start of the first sample to the end of the last sample. This includes any intervals between samples, as it is supposed to represent the load on the server. The formula is: Throughput = (number of requests) / (total time).

给出最终公式:

endTime = lastSampleStartTime + lastSampleLoadTime
startTime = firstSampleStartTime
converstion = unit time conversion value

Throughput = Numrequests / ((endTime - startTime)*conversion)

这篇关于从 Jmeter jtl 日志文件计算吞吐量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆