Why Group Response time is more than the actual sum of individual request response time

I have two requests in group and after run the test 1 user 1 iteration. I have out the results to csv, and then checked the response time (duration), the group duration time is always is higher response time compare to both individual requests sum of both.

refer the attached screenshot…
both requests shows the duration time: 20.9798 + 31.2423 = 52.221 ms
but the same two requests in group duration time shows: 94.3533 ms

so my question… why the group duration time shows high? even we sub both requests also not that much time.

code:

import http from ‘k6/http’;
import { check, group } from ‘k6’;

let responses;

export default function () {
const requests = {
‘front page’: ‘https:/testapik6io/’,
‘features page’: {
method: ‘GET’,
url: ‘https:/testapik6io/public/crocodiles/2/’,
params: { headers: { ‘User-Agent’: ‘k6’ } },
},
};

group(‘authenticate’, function () {
responses = http.batch(requests);
});

}

hi @venkatareddy , welcome to the community forum!

If you run the test for multiple iteration with e.g.k6 run -o csv -i 10 script.js , then you will see, that this behaviour is true for the first iteration only. From the second iteration the group_duration will be similar to the largest request duration in the batch.

1 Like

Hi @bandorko thanks for response, I got it. But when I run multiple users like 5 users 10 iterations and collected the csv file.

But what I have observed this time, that the group name and group response time shows for every iteration getting individual response time each iteration. Is there any way we can get aggregate avg. response time for same group names.

It is because in csv output, you get all the metric points instead of the summary.

You can get the avg response time in the test end summary. By default you will get one line for the group_duration, but you can split it with the group name if you put a threshold on the group_duration metric. See the documentation.

     data_received..................: 2.4 MB 288 kB/s
     data_sent......................: 44 kB  5.2 kB/s
     group_duration.................: avg=203.76ms min=127.38ms med=228.97ms max=1.23s    p(90)=243.39ms p(95)=245.48ms
     ✓ { group:::authenticate }.....: avg=150.34ms min=127.38ms med=136.69ms max=408.95ms p(90)=147.51ms p(95)=255.33ms
     ✓ { group:::login }............: avg=257.19ms min=227.81ms med=237.68ms max=1.23s    p(90)=243.89ms p(95)=245.25ms
     http_req_blocked...............: avg=6.37ms   min=2.27µs   med=7.74µs   max=264.29ms p(90)=10.45µs  p(95)=11.41µs 
     http_req_connecting............: avg=3.08ms   min=0s       med=0s       max=127.33ms p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=135.58ms min=118.89ms med=128.54ms max=1.13s    p(90)=141.64ms p(95)=143.96ms

1 Like

Hi @bandorko thanks for the info.

The easy way that we can csv data only to make pivoted table by group, group duration. to reduce the coding for each group.