Load Testing (JMeter/k6) Cheat Sheet
Designing and running load tests with JMeter and k6 to validate performance, throughput, and breaking points.
2 PagesIntermediateFeb 20, 2026
Types of Performance Tests
Common categories of load testing by goal.
- Load test- Validate behavior under expected peak traffic
- Stress test- Push beyond expected capacity to find the breaking point
- Soak test- Sustain moderate load over a long duration to find memory leaks/degradation
- Spike test- Sudden burst of traffic to test elasticity and autoscaling
Basic k6 Script
A k6 load test script ramping virtual users and asserting response time.
javascript
import http from 'k6/http';import { check, sleep } from 'k6';export const options = { stages: [ { duration: '30s', target: 50 }, // ramp up { duration: '1m', target: 50 }, // stay at 50 VUs { duration: '10s', target: 0 }, // ramp down ], thresholds: { http_req_duration: ['p(95)<500'], // 95% of requests under 500ms http_req_failed: ['rate<0.01'], // error rate under 1% },};export default function () { const res = http.get('https://api.example.com/products'); check(res, { 'status is 200': (r) => r.status === 200 }); sleep(1);}
Running k6
Execute a k6 test and export results.
bash
k6 run script.js# Override VUs and duration from the CLIk6 run --vus 100 --duration 30s script.js# Output results to InfluxDB for Grafana dashboardsk6 run --out influxdb=http://localhost:8086/k6 script.js
Running JMeter Non-GUI (CI mode)
Run a JMeter test plan headlessly and generate an HTML report, recommended for CI.
bash
jmeter -n -t test-plan.jmx \ -l results.jtl \ -e -o report/# -n non-GUI mode, -t test plan, -l results log# -e -o generate HTML dashboard report after the run
Key Metrics to Watch
Metrics that matter most when interpreting load test results.
- Throughput (RPS)- Requests successfully processed per second
- Latency percentiles (p50/p95/p99)- Tail latency matters more than averages for user experience
- Error rate- Percentage of failed requests, watch for it rising as load increases
- Saturation point- The load level at which latency/error rate begins degrading non-linearly
Pro Tip
Always load-test against an environment sized and configured like production (same instance types, connection pools, autoscaling rules) — results from an undersized staging environment routinely mislead capacity planning.
Was this cheat sheet helpful?
Explore Topics
#LoadTestingJMeterK6#LoadTestingJMeterK6CheatSheet#DevOps#Intermediate#TypesOfPerformanceTests#BasicK6Script#RunningK6#Running#Testing#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance