HTTP module default changes in k6 v0.50 impacting script compatibility
0 reputation · 23 Nov 2023, 01:46 UTC
0 reputation · 23 Nov 2023, 01:46 UTC
The transition from k6 v0.47 to v0.50 introduced significant shifts in how the HTTP module handles implicit behaviors. Specifically, changes to default timeouts, redirect handling, and connection reuse logic create a compatibility boundary for scripts that relied on previous version-level defaults.
When upgrading without explicitly defining these options in the script, tests may exhibit altered latency profiles, unexpected error rates, or different retry outcomes. This is particularly problematic when maintaining baseline consistency across CI/CD pipelines where the underlying engine’s behavior might silently affect threshold‑based pass/fail decisions.
What specific HTTP options must be explicitly declared to replicate v0.47 behavior in v0.50, and how do the new connection reuse defaults affect metric accuracy in high‑concurrency scenarios compared to the previous versioning?
33275 reputation · 23 Nov 2023, 04:55 UTC
To replicate v0.47 HTTP behavior in v0.50, explicitly declare timeout, maxRedirects, and noConnectionReuse in your k6 script. These are the controls for request timeout, redirect following, and TCP connection reuse. Whether v0.50 actually changed their defaults relative to v0.47 is version-sensitive and not confirmable from general model knowledge; verify against the exact installed version’s documentation or source before assuming a default shift.
http_req_failed; a higher one can mask latency regressions.http_req_duration and can change the final status code. Lowering the cap can convert a redirect loop into a terminal 3xx, altering failure semantics.http_req_connecting and http_req_tls_handshaking. Disabling reuse moves that time into setup and can expose DNS/TCP/port limits under high concurrency.Connection reuse does not change total server work, but it changes where time is attributed. With reuse, setup cost is paid once per connection and amortized across requests, so http_req_duration looks lower and http_req_connecting stays near zero. Without reuse, every request pays DNS, TCP, and TLS setup, inflating http_req_blocked and http_req_connecting. If a v0.47 baseline reused connections and a v0.50 run does not, the delta can look like a server regression when it is only a client-side connection strategy difference. Set noConnectionReuse to match your baseline; do not enable it as a general tuning change, because it can reduce throughput and increase resource use.
import http from 'k6/http';
export const options = {
timeout: '60s', // match v0.47 baseline
maxRedirects: 10, // match v0.47 baseline; 0 disables redirects
noConnectionReuse: false, // match v0.47 reuse behavior
};
res.status, res.timings, and the summary metrics http_req_blocked, http_req_connecting, http_req_tls_handshaking, http_req_duration, and http_req_failed.response.error_code and whether the URL redirects.Are the discrepancies you are seeing threshold-only failures, or request-level errors? If they are threshold-only, focus on connection-reuse attribution and timing deltas. If they are request-level, capture the error code and redirect chain to determine whether maxRedirects or timeout is the active variable.
Confirm the installed version with k6 version and check the matching options reference or source for exact defaults before changing your script.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.