@eyeveebe, I actually hadn’t seen the CPU, but, I believe that shouldn’t have been the issue as I have a dedicated VM in the cloud only to run k6. I will check to see that, but, do let me know if there is something else I have in my code that I could have made a mistake on:
import http from 'k6/http';
import { check, sleep } from 'k6';
import { Counter, Rate, Trend } from 'k6/metrics';
import { htmlReport } from 'https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js';
import routes from './common/routes/routes';
import TokenFactory from './DataFactory/token.factory';
import exec from 'k6/execution';
import { getUniqueVenueFeature } from './utils/random';
const Bu='Feature_1';
const Index='4_parallel_run_4core16Mem_2minute_256target';
const Vus=256;
const Iteration=4;
export const options: any = {
setupTimeout: '600s',
scenarios: {
[Bu]: {
executor: 'ramping-vus',
exec: 'FeatureRun',
startVUs: 1,
stages: [{
duration: '2m', target: 256
}],
gracefulRampDown: '0s',
tags: { my_custom_tag: Index },
env: {
bu: Bu,
index: Index,
Feature_creation_scenario: Bu,
},
},
},
};
let customMetrics = new Trend('Response timing', true);
let lastRequestTime = new Date().getTime();
let successCount = new Counter('successful_request');
let failureRate = new Rate('check_failure_rate');
export function FeatureRun() {
const iterationNumber = exec.scenario.iterationInTest;
const options = {
timeout: '1000000', //10min
headers: {
'Content-Type': 'application/json',
Authorization: TokenFactory.getToken(__ENV.bu),
},
};
const res = http.put(
routes.CREATE_NEW_Feature,
JSON.stringify(getUniqueVenueFeature()),
options,
);
let checkRes = check(res, {
'is status is 201': (r) => {
console.log(
`Running scenerio ${__ENV.index}\'s ${iterationNumber} iteration.TimeFromLastRequest: `,
new Date().getTime() - lastRequestTime,
' response: ',
r.body, 'res duration timing: ', res.timings.duration, 'VUid: ',
exec.vu.idInInstance,
);
lastRequestTime = new Date().getTime();
return r.status === 201;
},
});
if (checkRes) {
successCount.add(1);
}
failureRate.add(!checkRes);
customMetrics.add(res.timings.duration);
}
export function handleSummary(data: any) {
return {
[`src/report/${Index}_single_Feature_parallel.html`]: htmlReport(data),
};
}