0
votes

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

3 Answers

5
votes

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:

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

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)

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

Per the glossary:

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

Giving a final formula of:

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

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

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

There is. You can use CMD tool from JMeter Plugins project to generate Aggregate report in CSVs.

http://jmeter-plugins.org/wiki/JMeterPluginsCMD/

0
votes

Assuming the you want to calculate the throughput at 20 threads. Following are the steps to follow:

  1. Clean the jtl file with remaining entries just for 20 threads. Save this file with 20 threads calls.
  2. Get the hour min sec from the time stamp using following command

    awk -F"[, .]" '{print $2}' summary.jtl > tps1
    
  3. Run following command to get throughput / sec

    sort tps1 | uniq -c  > tps2