Prompt
I need load testing that works with our CI pipeline
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Yes — the easiest way to make load testing work well in CI is to treat it as a repeatable, scriptable check rather than a manual performance event.
What “CI-friendly load testing” should look like
A good setup usually has these properties:
- Runs headlessly from the pipeline
- Uses scripts/config checked into git
- Has clear pass/fail thresholds
e.g. p95 latency < 300ms, error rate < 1% - Is reproducible across branches and environments
- Doesn’t require manual setup
- Can run at different levels
- smoke load test on every PR
- heavier test nightly or pre-release
Common tools that work well in CI
Here are the most common options:
1) k6
Best if you want:
- simple scripting
- strong CI support
- easy thresholds
- good reporting
Example:
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
vus: 10,
duration: '1m',
thresholds: {
http_req_duration: ['p(95)<300'],
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const res = http.get('https://your-service.example.com/api/health');
check(res, { 'status is 200': r => r.status === 200 });
sleep(1);
}
Run in CI:
k6 run test.js
2) JMeter
Good for:
- more complex scenarios
- teams already using it
- GUI + CLI mode
CI usually runs:
jmeter -n -t test.jmx -l results.jtl
3) Gatling
Good for:
- Scala-based simulation
- strong reporting
- larger test suites
4) Locust
Good if your team prefers Python:
- very flexible
- easy to write scenarios
- works well in CI
Recommended CI pattern
A practical setup is:
On every PR
Run a small smoke load test:
- 1–5 virtual users
- 30–60 seconds
- validate major endpoints
- catch obvious regressions early
Nightly or on main
Run a fuller load test:
- realistic user counts
- longer duration
- more endpoints
- generate trend reports
Before release
Run a stress / soak / spike test:
- verify capacity and stability
- catch memory leaks or scaling issues
Example CI pipeline idea
If you use GitHub Actions:
name: load-test
on:
pull_request:
workflow_dispatch:
jobs:
load-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install k6
run: |
sudo gpg -k
sudo apt-get update
sudo apt-get install -y gnupg ca-certificates
curl -fsSL https://dl.k6.io/key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/k6-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install -y k6
- name: Run load test
run: k6 run tests/loadtest.js
Important best practices
- Use a dedicated test environment if possible
- Avoid polluting shared staging
- Parameterize target URLs
- Version your test scripts
- Store artifacts like results and reports
- Fail the build only on meaningful thresholds
- Keep PR tests short so they don’t slow development too much
Metrics to track
At minimum:
- latency: p50 / p95 / p99
- throughput: requests/sec
- error rate
- CPU/memory on service
- DB response time
- saturation indicators
If you want this to be reliable in CI
I’d recommend:
- k6 + thresholds + GitHub Actions/GitLab CI/Jenkins
- smoke test on PRs
- fuller load tests on a schedule
- results uploaded as artifacts
- alerts only when thresholds are exceeded
If you want, I can give you a ready-to-use CI example for:
- GitHub Actions
- GitLab CI
- Jenkins
- Azure DevOps
Or I can recommend the best tool based on your stack.