Expecting 10 HTTP requests, but summary shows 18 HTTP requests

Hello All,

Following is the code, expecting 10 HTTP requests, but the summary shows 18 HTTP requests.

import http from 'k6/http'

export default function () {
  **for (let id = 1; id <= 10; id++) {**
    http.get(`http://example.com/posts/${id}`);
  }
}
INFO[0000] Prometheus: configuring remote-write with prometheus mapping 
  execution: local
     script: 06_tag_request.js
     output: Output k6 metrics to prometheus remote-write endpoint

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)


running (00m02.3s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m02.3s/10m0s  1/1 iters, 1 per VU

     data_received..............: 16 kB   7.0 kB/s
     data_sent..................: 841 B   366 B/s
     http_req_blocked...........: avg=25.21ms  min=1µs      med=2µs      max=226.93ms p(90)=68.08ms  p(95)=226.93ms
     http_req_connecting........: avg=22.93ms  min=0s       med=0s       max=206.4ms  p(90)=61.92ms  p(95)=206.4ms 
     http_req_duration..........: avg=206.67ms min=206.13ms med=206.35ms max=208.59ms p(90)=207.61ms p(95)=208.59ms
     http_req_failed............: 100.00% ✓ 18       ✗ 0  
     http_req_receiving.........: avg=252.61µs min=49µs     med=128.5µs  max=1.19ms   p(90)=555.8µs  p(95)=1.19ms  
     http_req_sending...........: avg=20.5µs   min=10µs     med=12µs     max=66µs     p(90)=44.3µs   p(95)=66µs    
     http_req_tls_handshaking...: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s      
     http_req_waiting...........: avg=206.4ms  min=205.89ms med=206.1ms  max=208.53ms p(90)=207.14ms p(95)=208.53ms
     **http_reqs..................: 18      7.842273/s**
     iteration_duration.........: avg=2.29s    min=2.29s    med=2.29s    max=2.29s    p(90)=2.29s    p(95)=2.29s   
     iterations.................: 1       0.435682/s
     vus........................: 1       min=1      max=1
     vus_max....................: 1       min=1      max=1

Regards,
Bharath.

Hi @BharathM,

I would expect there will be some redirects as discussed in your previous question.

If I run the specific test code it gives me 10 requests exactly, so i can’t tell you what happens in your case to have 8 redirects and 2 not redirect :person_shrugging: .

I would recommend using -o json to see what request metrics are emitted- those will also include status codes and or use --http-debug or even the newly added way to dump SSL keys and use wireshark to see exactly what is being send and received.

In all of those questions you will probably pretty quickly find out why there are 18 requests

Thank you @mstoykov, I will investigate based on the information provide.