I am trying to understand what the web dashboard in k6 shows and what it means. I am having trouble understanding the failure rate metric.
I have the following script:
import { check } from 'k6';
import http from 'k6/http';
import { Counter } from 'k6/metrics';
export const options = {
discardResponseBodies: true,
scenarios: {
contacts: {
executor: 'ramping-arrival-rate',
// Start iterations per `timeUnit`
startRate: 5,
// Start `startRate` iterations per minute
timeUnit: '1s',
// Pre-allocate necessary VUs.
preAllocatedVUs: 50,
stages: [
{ target: 5, duration: '10s' },
{ target: 500, duration: '5m' },
],
},
},
};
const non200 = new Counter('non_200_responses');
export default () => {
const res = http.get('http://localhost:8000/customers');
if (res.status !== 200) {
non200.add(1);
}
};
I fully shut down my server and ran the script above. I would expect that the Request rate should equal the Request failed. The request rate is as expected, maxing out at 500rps but the request failed is constant at 1rps. Is this a bug or should I set things up different? Since the server was not even running I would expect that the request rate and failed rate should be equal.
4 posts - 2 participants