一键导入
load-testing
Design and execute load tests to validate performance under stress, identify scalability limits, and ensure SLA compliance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design and execute load tests to validate performance under stress, identify scalability limits, and ensure SLA compliance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Design AI agents with appropriate capabilities, tools, and personas for specific software development tasks
Design RESTful APIs with proper resource modeling, HTTP methods, error handling, and clear contracts following REST principles
Document APIs comprehensively with signatures, parameters, return values, errors, and working code examples for developer reference
Implement robust third-party API integrations with proper authentication, error handling, and rate limiting
Apply proven architectural patterns (MVC, layered, microservices) to create maintainable systems with clear separation of concerns
Systematically reproduce, diagnose, and analyze bugs to determine root cause, assess severity, and plan fix strategy
| name | Load Testing |
| description | Design and execute load tests to validate performance under stress, identify scalability limits, and ensure SLA compliance |
| category | performance |
| required_tools | ["Bash","Write","WebSearch"] |
Validate application performance under realistic and peak load conditions, identify scalability bottlenecks, and ensure systems meet performance SLAs.
Define Performance Requirements
Design Test Scenarios
Select Tools
Execute Tests
Analyze Results
Context: Load testing an e-commerce API
Test Scenario (k6):
// load-test.js
import http from 'k6/http';
import { check, sleep } from 'k6';
import { Rate } from 'k6/metrics';
const errorRate = new Rate('errors');
export const options = {
stages: [
{ duration: '2m', target: 100 }, // Ramp to 100 users
{ duration: '5m', target: 100 }, // Stay at 100
{ duration: '2m', target: 200 }, // Ramp to 200
{ duration: '5m', target: 200 }, // Stay at 200
{ duration: '2m', 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 () {
// Browse products
let res = http.get('https://api.example.com/products');
check(res, {
'products loaded': (r) => r.status === 200,
'response < 500ms': (r) => r.timings.duration < 500,
}) || errorRate.add(1);
sleep(1); // Think time
// View product detail
res = http.get('https://api.example.com/products/123');
check(res, {
'product detail loaded': (r) => r.status === 200,
}) || errorRate.add(1);
sleep(2);
// Add to cart
res = http.post('https://api.example.com/cart', JSON.stringify({
product_id: 123,
quantity: 1
}), {
headers: { 'Content-Type': 'application/json' },
});
check(res, {
'added to cart': (r) => r.status === 201,
}) || errorRate.add(1);
sleep(1);
}
Run Test:
k6 run --out json=results.json load-test.js
Results Analysis:
scenarios: (100.00%) 1 scenario, 200 max VUs, 18m0s max duration
✓ products loaded
✓ response < 500ms
✓ product detail loaded
✓ added to cart
checks.........................: 98.50% ✓ 19700 ✗ 300
data_received..................: 45 MB 2.8 MB/s
data_sent......................: 8.5 MB 530 kB/s
http_req_blocked...............: avg=1.2ms min=0s med=0s max=150ms p(95)=5ms p(99)=25ms
http_req_duration..............: avg=245ms min=45ms med=180ms max=2.5s p(95)=480ms p(99)=850ms
http_req_failed................: 1.50% ✓ 300 ✗ 19700
http_reqs......................: 20000 1250/s
iteration_duration.............: avg=4.8s min=4s med=4.5s max=8s
iterations.....................: 5000 312.5/s
vus............................: 200 min=0 max=200
vus_max........................: 200 min=200 max=200
Analysis:
Bottleneck Investigation:
Recommendations: