What is the difference between group_duration and iteration_duration?

What is the difference between group_duration and iteration_duration ? p(95) numbers very close to each other … By the way, when I read the document related to group duration, group duration includes the setup time,too. But my all project finished 4m15s. And CreatePicking load test finished 3m54s . What is the calculatation logic of group and iteration duration p(95) value?

running (04m15.9s), 00/10 VUs, 10 complete and 0 interrupted iterations
CreatePicking ✓ [======================================] 10 VUs  03m54.0s/10m0s  10/10 iters, 1 per VU
INFO[0258] [k6-reporter v2.3.0] Generating HTML summary report  source=console
     █ setup

     █ Picking load test senaryosu çalıştırır

       ✓ 204 is 204


     checks......................................................................................................: 100.00% ✓ 10       ✗ 0
     data_received...............................................................................................: 284 kB  1.1 kB/s
     data_sent...................................................................................................: 2.0 MB  7.9 kB/s
     group_duration..............................................................................................: avg=218106.77ms min=178652.87ms med=220447.96ms max=234007.87ms p(90)=232024.47ms p(95)=233016.17ms    
     http_req_blocked............................................................................................: avg=5.61ms      min=0.00ms      med=0.00ms      max=364.46ms    p(90)=0.00ms      p(95)=0.00ms
     http_req_connecting.........................................................................................: avg=1.55ms      min=0.00ms      med=0.00ms      max=65.70ms     p(90)=0.00ms      p(95)=0.00ms
     http_req_duration...........................................................................................: avg=4544.26ms   min=300.14ms    med=5050.76ms   max=18100.14ms  p(90)=7790.33ms   p(95)=9549.71ms      
       { expected_response:true }................................................................................: avg=4544.26ms   min=300.14ms    med=5050.76ms   max=18100.14ms  p(90)=7790.33ms   p(95)=9549.71ms      
     http_req_failed.............................................................................................: 0.00%   ✓ 0        ✗ 484
     http_req_receiving..........................................................................................: avg=0.25ms      min=0.00ms      med=0.00ms      max=15.80ms     p(90)=0.44ms      p(95)=0.80ms
     http_req_sending............................................................................................: avg=0.24ms      min=0.00ms      med=0.00ms      max=19.43ms     p(90)=0.58ms      p(95)=0.67ms
     http_req_tls_handshaking....................................................................................: avg=3.53ms      min=0.00ms      med=0.00ms      max=170.66ms    p(90)=0.00ms      p(95)=0.00ms
     http_req_waiting............................................................................................: avg=4543.77ms   min=298.98ms    med=5050.16ms   max=18099.77ms  p(90)=7790.28ms   p(95)=9549.62ms      
     http_reqs...................................................................................................: 484     1.891715/s
     iteration_duration..........................................................................................: avg=200263.58ms min=21831.75ms  med=217024.53ms max=234007.87ms p(90)=231804.10ms p(95)=232905.99ms    
     iterations..................................................................................................: 10      0.039085/s
     vus.........................................................................................................: 1       min=0      max=10
     vus_max.....................................................................................................: 10      min=10     max=10

Hi @Yusuf,

Thanks for reaching out, and sorry for the response delay!

As stated in the documentation, whenever you create a group, k6 will start tracking its performance (the statements that are scoped inside the function you pass as the second argument) separately, and store the results in the group_duration metric. Note that when you create multiple groups, each gets tagged with a separate tag based on the name you give it. So as a result, group_duration stores results from all the groups, and tags each subgroup with its own tag, allowing to retrieve its subset of specific values later on.

Thus, in the k6 cli summary, the group_duration displayed reads as “the time spent executing statements that were scoped inside of groups”.

On the other hand, iteration_duration keeps track of the time it took to execute a whole iteration of a script, including the setup and teardown phases. N.B: workarounds exist to exclude setup and teardown.

As a result, although in your scenario group_duration and iteration_duration display somewhat similar values, I believe it’s probably due to having most of your statements inside of groups? I would expect group_duration and iteration_duration to show significant differences as soon as time-consuming steps happen outside of groups, or inside setup/teardown.

Finally, p(95) stands for 95% percentile. It represents the value under which 95% of the metrics value stand. In your case, 95% of the group statements execution took less than 233016ms, while 95% of the iterations took 232905ms.

I hope this helps! Let me know if that answers your question. If not, don’t hesitate to post an example of the script you’re using to help us answer your question better :+1: