Build a breakpoint script
If you completed the stress milestones, you already have degradation results or a documented clean run. Breakpoint testing is optional and runs on a dedicated stack when you want an approximate outer bound beyond that stress profile.
Breakpoint testing ramps load continuously toward high load until thresholds fail or the ramp ends: an approximate outer bound, not an operating target.
Note: On QuickPizza, the ramp often completes without abort. You still learn ramping-arrival-rate and abortOnFail. For your own stack, use a dedicated test environment and disable autoscaling on components you want to measure. Refer to Breakpoint testing.
Tip: To see abortOnFail stop a run on QuickPizza, run QuickPizza locally with Docker and point http.get(...) at your local instance. You can use the same breakpoint.js script from this milestone to ramp a local instance to failure.
This milestone introduces the ramping-arrival-rate executor (RPS ramps over time) and abortOnFail thresholds (stop the run when conditions fail). For one-request scripts, iterations per second matches RPS.
To build a breakpoint script, complete the following steps:
In your code editor, create a new file named
breakpoint.jsand add the following imports:import http from 'k6/http'; import { check, sleep } from 'k6';Define a scenario using the
ramping-arrival-rateexecutor.The following example ramps from 0 to 200 iterations per second over 10 minutes, pre-allocating enough VUs to sustain the target rate. Plan for about 10 minutes of runtime on the next milestone when you run this script as written. Shorten
duration(for example to3m) while learning if you want a faster iteration.export const options = { scenarios: { breakpoint: { executor: 'ramping-arrival-rate', startRate: 0, timeUnit: '1s', preAllocatedVUs: 500, maxVUs: 1000, stages: [ { duration: '10m', target: 200 }, ], }, }, thresholds: { http_req_duration: [ { threshold: 'p(95)<2000', abortOnFail: true, delayAbortEval: '30s', }, ], http_req_failed: [ { threshold: 'rate<0.20', abortOnFail: true, delayAbortEval: '30s', }, ], }, };The
preAllocatedVUsandmaxVUsvalues avoid VU starvation during the ramp.delayAbortEvalwaits before abort evaluation so early noise does not stop the run; see Thresholds.Note: Adjust
targetanddurationfor your stack. If stress showed no degradation on QuickPizza, you may finish the full ramp without abort, which is still a valid result.Add the default function with the same checks you’ve used throughout this path:
export default function () { const res = http.get('https://quickpizza.grafana.com'); check(res, { 'status is 200': (r) => r.status === 200, 'response body is not empty': (r) => r.body.length > 0, }); sleep(0.1); }The
sleepvalue is shorter than in the stress test because theramping-arrival-rateexecutor controls the request rate independently of VU think time.If you are testing your own service, replace the URL in
http.get(...)with your endpoint, then savebreakpoint.js.
In the next milestone, you run this breakpoint test and read off the load at test stop (threshold abort or end of ramp).