import http from 'k6/http';
import { check } from 'k6';
// CI/CD-friendly: short test with strict thresholds
export const options = {
vus: 20,
duration: '1m',
thresholds: {
http_req_duration: ['p(95)<300', 'p(99)<500'],
http_req_failed: ['rate<0.01'],
checks: ['rate>0.99'],
},
};
export default function () {
const res = http.get('https://staging.myapp.com/api/health');
check(res, {
'status 200': (r) => r.status === 200,
'has body': (r) => r.body.length > 0,
});
}At minimum: a 1-minute smoke test with 5-10 VUs against your critical endpoints, with thresholds on p95 latency and error rate. This catches major regressions in seconds.
Start with staging/pre-production environments. Once comfortable, canary load tests in production (low VUs, short duration) can catch issues that only appear with real infrastructure.
Run short smoke tests (10-20 VUs, 1 minute) on every PR. Run full load tests nightly or before releases. Use k6 thresholds for automatic pass/fail decisions.
Load test your REST and GraphQL APIs with up to 200 virtual users for free. Real-time metrics, JavaScript scripting, and instant results.
Benchmark your REST API performance with precise p50, p95, p99 latency metrics. Compare endpoints and track regressions over time.
Use load testing for infrastructure capacity planning. Determine how many users your servers can handle and when to scale.