Hello!
I’m studying K6 and I have a doubt.
I ran a test with this code:
The Total Requests was 40479 and the total of Iterations was 20245.
Since I have only one request in my default function, why do I have more requests than iterations? Shouldn’t they be the same?
Hey @tiagotaq2,
Welcome to our community, thanks for sharing your question here
Shouldn’t they be the same?
“Yes” (between quotes), you’re almost right!
By having a quick look at the script, the intuition says that they should be the same, indeed.
However, what I suspect is happening here, and likely confirmed by the fact that the total number of HTTP requests is basically 2x the amount of iterations, is that the test.k6.io
enforces the use of HTTPS.
So, on each iteration, the VU is receiving a 308 Permanent Redirect
pointing to the same domain, but secure, as response to the first request, and following such redirection, performing a 2nd request per iteration.
You can easily confirm that by either:
- Using
https://test.k6.io
instead of http://test.k6.io
.
- Setting
redirects
to 0
from HTTP params: see docs.
- Setting
maxRedirects
to 0
from k6 options: see docs.
I hope that helps you clarify what you’re experiencing and to understand why it happens.
2 Likes
@joanlopez
You’re right!
I changed the URL to “https” and the total requests and the total of iterations became the same.
Thank you!
1 Like