HabitaNexus/monorepo / skills/system-reliability-engineering/load-testing-performance
load-testing-performance
Unverified| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.3 KB |
| scripts/README.md | markdown | 3.3 KB |
| scripts/k6/advanced-scenarios.js | script | 3.5 KB |
| scripts/k6/basic-load.js | script | 1.7 KB |
| scripts/k6/performance-comparison.js | script | 1.2 KB |
| scripts/k6/rust-api-load.js | script | 1.7 KB |
| scripts/k6/stress-test.js | script | 1.0 KB |
| scripts/nodejs/memory-profiler.js | script | 2.9 KB |
| scripts/nodejs/package.json | manifest | 551 B |
| scripts/nodejs/performance-profiler.js | script | 2.1 KB |
| scripts/python/capacity_calculator.py | script | 6.6 KB |
| scripts/python/requirements.txt | manifest | 109 B |
| scripts/rust/Cargo.toml | manifest | 270 B |
| scripts/rust/benches/my_benchmark.rs | script | 1.0 KB |
scripts/k6/basic-load.js
View on GitHub/**
* k6 Basic Load Test
*
* Basic load test script for API endpoints.
*
* Usage:
* k6 run basic-load.js
* k6 run basic-load.js --env API_TOKEN=your-token
* k6 run basic-load.js --env BASE_URL=https://api.example.com
*/
import http from 'k6/http';
import { check, sleep } from 'k6';
import { Rate, Trend } from 'k6/metrics';
// Custom metrics
const errorRate = new Rate('errors');
const requestDuration = new Trend('request_duration');
export const options = {
stages: [
{ duration: '2m', target: 100 }, // Ramp up to 100 users
{ duration: '5m', target: 100 }, // Stay at 100 users
{ duration: '2m', target: 200 }, // Ramp up to 200 users
{ duration: '5m', target: 200 }, // Stay at 200 users
{ duration: '2m', target: 0 }, // Ramp down to 0 users
],
thresholds: {
http_req_duration: ['p(95)<500', 'p(99)<1000'], // 95% under 500ms, 99% under 1s
http_req_failed: ['rate<0.01'], // Error rate under 1%
errors: ['rate<0.01'],
},
};
export default function () {
const baseUrl = __ENV.BASE_URL || 'https://api.example.com';
const apiToken = __ENV.API_TOKEN || '';
// Test endpoint
const response = http.get(`${baseUrl}/api/v1/users`, {
headers: {
'Authorization': apiToken ? `Bearer ${apiToken}` : '',
},
});
// Check response
const success = check(response, {
'status is 200': (r) => r.status === 200,
'response time < 500ms': (r) => r.timings.duration < 500,
'has data': (r) => {
try {
const body = JSON.parse(r.body);
return body.data && body.data.length > 0;
} catch {
return false;
}
},
});
errorRate.add(!success);
requestDuration.add(response.timings.duration);
sleep(1);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |