I am load testing a facsimile of a production API. Request requires attachment of a 10Mb zipfile.
I am getting >90% failed iterations, despite (i think) provisioning plenty of VUs.
I know the script works, as if i change the attached file to a tiny one, with 1000s of requests, all succeed.
similarly, 1 single iteration with the 10Mb file, succeeds also.
Requests take an average of 500ms to complete (API logs from previously succesful iterations):
POST /api/v1/products 201 544.153 ms
POST /api/v1/products 201 687.144 ms
POST /api/v1/products 201 744.069 ms
POST /api/v1/products 201 771.189 ms
POST /api/v1/products 201 466.066 ms
I can see k6 ramping up on my machine resources Memory monitor, it does not run out of Memory).
The aim of the test is purely to check Memory usage of Multer in handling attachments on the locally running API.
Could someone help me figure out why iterations are failing?
import http from 'k6/http';
import { check, sleep } from 'k6';
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js';
const binFile = open('/Users/alanharrison/Peak/loadtest/10Mb.zip', 'b');
export const options = {
scenarios: {
constant_request_rate: {
executor: 'constant-arrival-rate',
rate: 1,
timeUnit: '1s', // 1 iterations per second, i.e. 1 RPS
duration: '10s',
preAllocatedVUs: 100, // how large the initial pool of VUs would be
maxVUs: 300, // if the preAllocatedVUs are not enough, we can initialize more
},
},
};
const BASE_URL = 'http://grafana.staged-by-discourse.com/api/v1/products';
const fd = new FormData();
fd.append('artifact', http.file(binFile, '10Mb.zip', 'application/zip'));
export default () => {
const res = http.post(BASE_URL, fd.body(), {
headers: { 'Content-Type': 'multipart/form-data; boundary=' + fd.boundary },
});
check(res, {
'is status 201': (r) => r.status === 201,
});
sleep(1);
};
i see these results:
running (1m01.0s), 000/100 VUs, 1 complete and 9 interrupted iterations
constant_request_rate ✓ [======================================] 009/100 VUs 10s 1.00 iters/s
iteration_duration.............: avg=38.5s min=38.5s med=38.5s max=38.5s p(90)=38.5s p(95)=38.5s
iterations.....................: 1 0.016393/s