testing-performance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePerformance Testing
性能测试
Test application speed, responsiveness, stability, and scalability under various load conditions.
测试应用在不同负载条件下的速度、响应性、稳定性以及可扩展性。
When to use me
适用场景
Use this skill when:
- Preparing for traffic spikes or seasonal loads
- Testing application scalability
- Identifying performance bottlenecks
- Validating SLAs (Service Level Agreements)
- Comparing performance before/after changes
- Capacity planning and infrastructure sizing
- Ensuring user experience under load
当你有以下需求时可使用本技能:
- 为流量高峰或季节性负载做准备
- 测试应用可扩展性
- 识别性能瓶颈
- 验证SLA(服务水平协议)
- 对比变更前后的性能表现
- 容量规划与基础设施规格选型
- 保障负载下的用户体验
What I do
功能说明
- Load testing: Simulate expected user traffic
- Stress testing: Find breaking points and limits
- Spike testing: Test sudden traffic surges
- Endurance testing: Check for memory leaks over time
- Scalability testing: Verify horizontal/vertical scaling
- Configuration testing: Optimize performance settings
- Benchmarking: Compare against baseline metrics
- 负载测试:模拟预期用户流量
- 压力测试:找到系统断点与性能上限
- 峰值测试:测试突发流量激增场景
- 耐久性测试:长时间运行检测内存泄漏
- 可扩展性测试:验证水平/垂直扩容效果
- 配置测试:优化性能配置项
- 基准测试:与基线指标做对比
Examples
示例
bash
undefinedbash
undefinedLoad testing tools
Load testing tools
npx autocannon -c 100 -d 60 https://app.example.com
wrk -t12 -c400 -d30s https://app.example.com
k6 run script.js # Grafana k6
jmeter -n -t testplan.jmx -l results.jtl
npx autocannon -c 100 -d 60 https://app.example.com
wrk -t12 -c400 -d30s https://app.example.com
k6 run script.js # Grafana k6
jmeter -n -t testplan.jmx -l results.jtl
Performance monitoring
Performance monitoring
npm run test:perf # Custom performance suite
lighthouse https://app.example.com --output json
webpagetest test https://app.example.com
npm run test:perf # Custom performance suite
lighthouse https://app.example.com --output json
webpagetest test https://app.example.com
Stress testing
Stress testing
artillery run stress.yml
npx loadtest -n 10000 -c 100 https://api.example.com
artillery run stress.yml
npx loadtest -n 10000 -c 100 https://api.example.com
Memory and CPU profiling
Memory and CPU profiling
node --inspect script.js
python -m cProfile script.py
go test -bench=. -benchmem
undefinednode --inspect script.js
python -m cProfile script.py
go test -bench=. -benchmem
undefinedOutput format
输出格式
Performance Test Results:
──────────────────────────────
Load Test (100 concurrent users, 5 minutes):
✅ Average Response Time: 245ms (< 500ms target)
✅ 95th Percentile: 412ms
✅ Throughput: 1,234 req/sec
✅ Error Rate: 0.1% (< 1% target)
⚠️ CPU Usage: 85% (approaching limit)
Stress Test (Breaking Point):
❌ System fails at 850 concurrent users
⚠️ Database connection pool exhausted at 800 users
✅ Graceful degradation observed
Memory Usage (24-hour endurance):
⚠️ Memory leak detected: +2MB/hour
❌ OutOfMemory after 18 hours
Summary: Meets most performance targets, needs memory leak fix性能测试结果:
──────────────────────────────
负载测试(100并发用户,5分钟):
✅ 平均响应时间:245ms (< 500ms 目标)
✅ 95分位响应时间:412ms
✅ 吞吐量:1,234 次请求/秒
✅ 错误率:0.1% (< 1% 目标)
⚠️ CPU 使用率:85% (接近上限)
压力测试(断点测试):
❌ 850并发用户时系统故障
⚠️ 800并发用户时数据库连接池耗尽
✅ 观测到优雅降级表现
内存使用情况(24小时耐久测试):
⚠️ 检测到内存泄漏:每小时增长2MB
❌ 运行18小时后出现内存溢出
总结:满足大部分性能指标,需修复内存泄漏问题Notes
注意事项
- Establish performance baselines before testing
- Test in production-like environments
- Monitor system resources during tests
- Consider network latency and geography
- Test with realistic data volumes
- Automate performance regression testing
- Document performance requirements and SLAs
- Use APM (Application Performance Monitoring) tools
- 测试前先建立性能基线
- 在类生产环境中开展测试
- 测试过程中监控系统资源
- 考虑网络延迟与地域因素
- 使用符合实际场景的数据量测试
- 自动化性能回归测试
- 记录性能需求与SLA
- 使用APM(应用性能监控)工具