Performance and load testing with k6 and Locust. Use when validating system performance under load, stress testing, identifying bottlenecks, or establishing performance baselines.
View on GitHubyonatangross/orchestkit
ork
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/yonatangross/orchestkit/blob/main/skills/performance-testing/SKILL.md -a claude-code --skill performance-testingInstallation paths:
.claude/skills/performance-testing/# Performance Testing
Validate system behavior under load.
## k6 Load Test (JavaScript)
```javascript
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '30s', target: 20 }, // Ramp up
{ duration: '1m', target: 20 }, // Steady
{ duration: '30s', target: 0 }, // Ramp down
],
thresholds: {
http_req_duration: ['p(95)<500'], // 95% under 500ms
http_req_failed: ['rate<0.01'], // <1% errors
},
};
export default function () {
const res = http.get('http://localhost:8500/api/health');
check(res, {
'status is 200': (r) => r.status === 200,
'response time < 200ms': (r) => r.timings.duration < 200,
});
sleep(1);
}
```
## Locust Load Test (Python)
```python
from locust import HttpUser, task, between
class APIUser(HttpUser):
wait_time = between(1, 3)
@task(3)
def get_analyses(self):
self.client.get("/api/analyses")
@task(1)
def create_analysis(self):
self.client.post(
"/api/analyses",
json={"url": "https://example.com"}
)
def on_start(self):
"""Login before tasks."""
self.client.post("/api/auth/login", json={
"email": "test@example.com",
"password": "password"
})
```
## Test Types
### Load Test
```javascript
// Normal expected load
export const options = {
vus: 50, // Virtual users
duration: '5m', // Duration
};
```
### Stress Test
```javascript
// Find breaking point
export const options = {
stages: [
{ duration: '2m', target: 100 },
{ duration: '2m', target: 200 },
{ duration: '2m', target: 300 },
{ duration: '2m', target: 400 },
],
};
```
### Spike Test
```javascript
// Sudden traffic surge
export const options = {
stages: [
{ duration: '10s', target: 10 },
{ duration: '1s', target: 1000 }, // Spike!
{ duration: '3m', target: 1000 },
{ duration: '10s', target: 10 },
],
};
```