--- description: Execute performance testing and optimization analysis argument-hint: [test-scenario] [load-level] --- # Performance Testing Command Execute comprehensive performance testing and optimization analysis with detailed metrics. ## Context - Test scenario: $1 (load|stress|spike|endurance - default: load) - Load level: $2 (light|medium|heavy|extreme - default: medium) - Application endpoints: @src/routes - Performance baseline: @performance-baseline.json ## Performance Testing Strategy ### 1. **Load Testing** - Simulate normal user traffic - Measure response times and throughput - Validate system stability - Identify performance bottlenecks ### 2. **Stress Testing** - Push system beyond normal capacity - Identify breaking points - Test system recovery - Validate error handling ### 3. **Performance Analysis** - Response time analysis - Throughput measurement - Resource utilization monitoring - Database performance assessment ### 4. **Optimization Recommendations** - Performance bottleneck identification - Scalability improvement suggestions - Resource optimization strategies - Caching implementation guidance ## Performance Metrics - Response time (p50, p95, p99) - Throughput (requests per second) - Error rate and availability - Resource utilization (CPU, memory, disk) ## Expected Outcome - Detailed performance test report - Performance metrics and benchmarks - Bottleneck identification and analysis - Actionable optimization recommendations ## Performance Thresholds - Response time: < 200ms (p95) - Throughput: > 1000 RPS - Error rate: < 0.1% - Availability: > 99.9% ## Failure Analysis If performance targets not met: - Root cause analysis - Performance optimization plan - Infrastructure scaling recommendations - Code optimization suggestions