---
type: reference
---

# Performance Optimization

Optimize application performance end-to-end using specialized performance and optimization agents to address real bottlenecks through a data-driven strategy that emphasizes modern observability practices, user-centric performance metrics, and cost-effective optimization strategies.

## Configuration Options
- `performance_focus`: "latency" | "throughput" | "cost" | "balanced" (default: "balanced")
- `optimization_depth`: "quick-wins" | "comprehensive" | "enterprise" (default: "comprehensive")
- `tools_available`: ["datadog", "newrelic", "prometheus", "grafana", "k6", "gatling"]
- `budget_constraints`: Set maximum acceptable costs for infrastructure changes
- `user_impact_tolerance`: "zero-downtime" | "maintenance-window" | "gradual-rollout"

## Content Sections
### Phase 1: Performance Profiling & Baseline
#### 1. Comprehensive Performance Profiling
...
#### 2. Observability Stack Assessment
...
#### 3. User Experience Analysis
...

### Phase 2: Database & Backend Optimization
#### 4. Database Performance Optimization
...
#### 5. Backend Code & API Optimization
...
#### 6. Microservices & Distributed System Optimization
...

### Phase 3: Frontend & CDN Optimization
#### 7. Frontend Bundle & Loading Optimization
...
#### 8. CDN & Edge Optimization
...
#### 9. Mobile & Progressive Web App Optimization
...

### Phase 4: Load Testing & Validation
#### 10. Comprehensive Load Testing
...
#### 11. Performance Regression Testing
...

### Phase 5: Monitoring & Continuous Optimization
#### 12. Production Monitoring Setup
...
#### 13. Continuous Performance Optimization
...

## Output Format / Reports
Detailed performance profiles, optimization reports, observability assessment reports, UX performance reports, Core Web Vitals analysis, user impact assessments, optimized queries, new indexes, caching strategy, connection pool configuration, CDN configuration, edge caching rules, compression setup, geographic optimization, load test results, performance under load, breaking points, scalability analysis, monitoring dashboards, alert rules, SLI/SLO definitions, runbooks, performance budget tracking, optimization backlog, capacity planning, review process.

## Success Criteria
- **Response Time**: P50 < 200ms, P95 < 1s, P99 < 2s for critical endpoints
- **Core Web Vitals**: LCP < 2.5s, FID < 100ms, CLS < 0.1
- **Throughput**: Support 2x current peak load with <1% error rate
- **Database Performance**: Query P95 < 100ms, no queries > 1s
- **Resource Utilization**: CPU < 70%, Memory < 80% under normal load
- **Cost Efficiency**: Performance per dollar improved by minimum 30%
- **Monitoring Coverage**: 100% of critical paths instrumented with alerting

Performance optimization target: [user-defined]

[source: application-performance/commands/performance-optimization.md]