Hello k6 Community. I am struggling with a scenario that I cannot wrap my head around. I have a scenario defined in the following way:
{
"scenarios": {
"type1`": {
"executor": "constant-arrival-rate",
"exec": "sendPayload1",
"rate": 100,
"timeUnit": "200s",
"duration": "200s",
"preAllocatedVUs": 5
},
"type2": {
"executor": "constant-arrival-rate",
"exec": "sendPayload2",
"rate": 100,
"timeUnit": "200s",
"duration": "200s",
"preAllocatedVUs": 5
},
"type3": {
"executor": "constant-arrival-rate",
"exec": "sendPayload3",
"rate": 30,
"timeUnit": "200s",
"duration": "200s",
"preAllocatedVUs": 5
},
"large": {
"executor": "constant-arrival-rate",
"exec": "sendLargePayload4",
"rate": 1,
"timeUnit": "200s",
"duration": "200s",
"preAllocatedVUs": 5
}
}
}
That is loading a declaration as follows:
// Load declarations
let payloadType1 = open(`${PAYLOADS_DIRECTORY}/Type1.xml`)
let payloadType2 = open(`${PAYLOADS_DIRECTORY}/Type2.xml`)
let payloadType3 = open(`${PAYLOADS_DIRECTORY}/Type3.xml`)
let payloadType4 = open(`${PAYLOADS_DIRECTORY}/Type4Large.xml`)
The ‘exec’ VU function for each subscenario inside the scenario is as follows:
- Login to API to obtain token,
- Verify token response to be HTTP 200 and valid with
check
- Prepare payload
- Send payload to the same component, different endpoint
- Done.
Each VU function defined in the scenario is almost the same, they slightly alter the headers or payload.
I am calling the same component to send the requests. The large payload is around 700 KB in size, tried a bigger one as well - 13 MB.
What I am experiencing is that some of the requests to login
page fails, e.g. 2 or 4 out of 230 with the following error:
time="2024-02-14T13:44:36+01:00" level=info msg="[tdmetj9gcm] [Wed Feb 14 2024 13:44:36 GMT+0100 (CET)] [API] LOGIN STOP for user: USER1, took: 60000 ms" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="tdmetj9gcm Response.status: 0" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="tdmetj9gcm Response.error: request timeout" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="tdmetj9gcm Response.error_code: 1050" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="tdmetj9gcm Response.status_text: " source=console
time="2024-02-14T13:44:36+01:00" level=info msg="[wfvx9xf0rn] [Wed Feb 14 2024 13:44:36 GMT+0100 (CET)] [API] LOGIN STOP for user: USER2 took: 60000 ms" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="wfvx9xf0rn Response.status: 0" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="wfvx9xf0rn Response.error: request timeout" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="wfvx9xf0rn Response.error_code: 1050" source=console
time="2024-02-14T13:44:36+01:00" level=info msg="wfvx9xf0rn Response.status_text: " source=console
time="2024-02-14T13:44:36+01:00" level=error msg="GoError: Access token could not be obtained.\n\tat go.k6.io/k6/js/modules/k6.(*K6).Fail-fm (native)\n\tat file:///C:/Source/k6-performance-testing/k6/performance-test.js:69:11(53)\n\tat go.k6.io/k6/js/modules/k6.(*K6).Group-fm (native)\n\tat sendDeclaration (file:///C:/Source/k6-performance-testing/k6/performance-test.js:59:8(6))\n" executor=constant-arrival-rate scenario=type1 source=stacktrace
It seems that for some reason, a request to send a large payload is responding in 3 seconds. If there’s a login operation being executed at period of those 3 seconds, it is not able to respond and it fails with a default timeout of 60 seconds.
So running a large payload submission is affecting other parts of the scenario.
What makes it more convoluted is that from JMeter I cannot reproduce the issue. And all requests pass. Even running k6 and Jmeter scenarios at the same time make k6 fails a few of them, where JMeter error rate on Login endpoint is 0% (with Connection: close header, w/o keep-alive).
Does anybody have any idea what it could be that:
- Large payload sent via k6 is affecting other endpoints calls? Seems like it’s ‘blocking’ - making other requests that happened to be started within this timeframe to fail?
- Removing large payload from the scenario makes the test fully pass, and all requests to respond correctly.
Thank you in advance for your replies.