workflow-performance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePerformance Optimization Workflow
性能优化工作流
Systematic approach to finding and fixing performance issues.
系统性排查与修复性能问题的方法。
Phase 1: Baseline
阶段1:基线测量
Agents:
performance-engineerMeasure current state:
- Response times (p50, p95, p99)
- Memory usage
- CPU utilization
- Database query times
- Bundle sizes (frontend)
- Render performance
Output: Baseline metrics report
Agents:
performance-engineer测量当前状态:
- 响应时间(p50、p95、p99分位)
- 内存使用率
- CPU利用率
- 数据库查询时间
- 包体积(前端)
- 渲染性能
输出: 基线指标报告
Phase 2: Bottleneck Identification
阶段2:瓶颈识别
Agents:
performance-engineerAnalysis:
- Profiling (CPU, memory)
- Query analysis (slow query log, EXPLAIN)
- Bundle analysis (webpack-bundle-analyzer)
- Network analysis (waterfall, latency)
Output: Bottleneck list with priority ranking
Agents:
performance-engineer分析内容:
- 性能剖析(CPU、内存)
- 查询分析(慢查询日志、EXPLAIN语句)
- 包分析(webpack-bundle-analyzer)
- 网络分析(瀑布图、延迟)
输出: 带优先级排序的瓶颈列表
Phase 3: Optimization Planning
阶段3:优化规划
Agents:
requirements-analyst- Prioritize by impact vs effort
- Define expected improvements
- Determine implementation order
- Set target metrics
Agents:
requirements-analyst- 按影响程度与实施成本优先级排序
- 定义预期优化效果
- 确定实施顺序
- 设置目标指标
Phase 4: Database Optimization
阶段4:数据库优化
Agents:
database-optimizerTasks:
- Query optimization (rewrite slow queries)
- Index creation/optimization
- Caching strategy (Redis, memcached)
- Connection pooling
Agents:
database-optimizer任务:
- 查询优化(重写慢查询)
- 索引创建/优化
- 缓存策略(Redis、memcached)
- 连接池配置
Phase 5: Code Optimization
阶段5:代码优化
Agents:
performance-engineerFocus:
- Algorithm efficiency (O(n) → O(log n))
- Memory management (leaks, allocation)
- Async operations (parallelize I/O)
- Application-level caching
Agents:
performance-engineer优化重点:
- 算法效率(从O(n)优化至O(log n))
- 内存管理(内存泄漏、内存分配)
- 异步操作(并行化I/O)
- 应用级缓存
Phase 6: Frontend Optimization
阶段6:前端优化
Agents:
performance-engineerTasks:
- Bundle size reduction
- Code splitting
- Lazy loading
- Asset optimization (images, fonts)
- Render optimization (virtualization, memoization)
Agents:
performance-engineer任务:
- 包体积缩减
- 代码分割
- 懒加载
- 资源优化(图片、字体)
- 渲染优化(虚拟化、记忆化)
Phase 7: Infrastructure Optimization
阶段7:基础设施优化
Agents:
devops-architectAreas:
- Scaling strategy (horizontal/vertical)
- Caching layers (CDN, reverse proxy)
- Load balancing
- Resource allocation
Agents:
devops-architect优化领域:
- 扩容策略(水平/垂直扩容)
- 缓存层(CDN、反向代理)
- 负载均衡
- 资源分配
Phase 8: Validation
阶段8:验证
Agents:
performance-engineerBlocking: Must meet targets
Targets:
- Response time: <200ms (p95)
- Memory usage: <200MB
- Bundle size: <500KB
Agents:
performance-engineer阻塞条件: 必须达成目标指标
目标:
- 响应时间:p95 < 200ms
- 内存使用率:< 200MB
- 包体积:< 500KB
Phase 9: Load Testing
阶段9:负载测试
Agents:
performance-engineerScenarios:
- Normal load (expected traffic)
- Peak load (2-3x normal)
- Stress test (find breaking point)
Duration: 30min per scenario
Agents:
performance-engineer测试场景:
- 常规负载(预期流量)
- 峰值负载(常规流量的2-3倍)
- 压力测试(寻找系统临界点)
持续时间:每个场景30分钟
Phase 10: Monitoring Setup
阶段10:监控配置
Agents:
devops-architect- Performance dashboards
- Alerting rules (degradation detection)
- Automated profiling (continuous)
Agents:
devops-architect- 性能仪表盘
- 告警规则(性能退化检测)
- 自动性能剖析(持续监控)
Success Criteria
成功标准
- Performance targets met
- Load tests pass
- Monitoring in place
- Documentation complete
- 达成性能目标
- 负载测试通过
- 监控配置完成
- 文档编写完成
Targets
优化目标
| Metric | Target |
|---|---|
| Response time improvement | 50% |
| Memory reduction | 30% |
| Cost reduction | 20% |
| 指标 | 目标值 |
|---|---|
| 响应时间提升 | 50% |
| 内存占用降低 | 30% |
| 成本降低 | 20% |
Quick Reference
快速参考
| Resource | Reference File |
|---|---|
| Optimization Techniques | |
| 资源 | 参考文件 |
|---|---|
| 优化技术 | |
Anti-patterns
反模式
- Optimizing without measuring first
- Micro-optimizations before algorithmic fixes
- Optimizing code that isn't the bottleneck
- No load testing before production
- 未先测量就进行优化
- 在算法优化前进行微优化
- 对非瓶颈代码进行优化
- 上线前未进行负载测试