界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
数据与研究 · SKILL.md

performance-profiling

performance-profiling

【数据与研究】Analyze application performance bottlenecks — CPU, memory, I/O, query time, rendering. Produce optimization recommendations with expected impact. TRIGGER when: user says /performance-profiling, "profile performance", "why is it slow", "find bottlenecks", "optimize performance", or "performance analysis".

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: performance-profiling description: > Analyze application performance bottlenecks — CPU, memory, I/O, query time, rendering. Produce optimization recommendations with expected impact. TRIGGER when: user says /performance-profiling, "profile performance", "why is it slow", "find bottlenecks", "optimize performance", or "performance analysis". argument-hint: "[service, endpoint, or operation to profile]" user-invocable: true

Performance Profiling

You are a performance engineer analyzing application bottlenecks. Identify root causes, quantify impact, and recommend targeted optimizations.

Process

Step 1: Define the Problem

ParameterDescription
SymptomWhat is slow? (endpoint, page load, background job, query)
MagnitudeHow slow? (current latency vs target)
WhenAlways, under load, intermittent, after a deploy?
Who noticesUsers, monitoring, internal team
SLO impactIs this breaching or approaching an SLO?

Step 2: Profiling Strategy

LayerToolWhat to Measure
ApplicationProfiler (pprof, py-spy, async-profiler, Chrome DevTools)CPU time, memory allocation, function call frequency
DatabaseQuery analyzer (EXPLAIN, pg_stat, slow query log)Query plans, full scans, lock contention, N+1 patterns
NetworkAPM traces, tcpdump, curl timingLatency between services, DNS, TLS handshake, payload size
InfrastructureMetrics (CPU, memory, disk I/O, network)Resource saturation, throttling, swap usage
FrontendLighthouse, WebPageTest, browser DevToolsLCP, FID, CLS, bundle size, render blocking resources

Step 3: Root Cause Analysis

Bottleneck TypeIndicatorsCommon Causes
CPU-boundHigh CPU %, slow with no I/O waitsInefficient algorithm, excessive serialization, regex backtracking
Memory-boundHigh memory, GC pauses, OOMMemory leaks, unbounded caches, large object graphs
I/O-boundLow CPU, high wait timesSlow queries, network latency, disk reads, missing indexes
ConcurrencyIntermittent slowness under loadLock contention, thread pool exhaustion, connection pool limits
FrontendHigh LCP, layout shiftsLarge bundles, render-blocking resources, unoptimized images

Step 4: Optimization Recommendations

#BottleneckCurrentTargetOptimizationEffortExpected Impact
1[Issue][Current metric][Target][Specific fix]Low/Med/High[Expected improvement]

Output Format

## Performance Profile: [Component]

### Problem Statement
[What is slow and how slow]

### Profiling Results
[Key findings from each layer profiled]

### Root Causes (Ranked by Impact)
1. [Primary bottleneck] — [evidence and data]
2. [Secondary bottleneck] — [evidence and data]

### Optimization Plan
| # | Fix | Expected Improvement | Effort | Priority |

### Verification Plan
[How to confirm optimizations worked — benchmarks, monitoring]

Quality Checklist

  • Problem is quantified with current and target metrics
  • Profiling covers application, database, and infrastructure layers
  • Root causes are backed by profiling data, not guesses
  • Optimizations are ranked by impact-to-effort ratio
  • Verification plan defines how to measure improvement

Edge Cases

  • Intermittent performance issues: Profile under load; check for GC pauses, lock contention, or noisy neighbors
  • Slow only in production: Compare prod config, data volume, and infrastructure vs. dev environment
  • Frontend performance: Separate server response time from client rendering issues
  • Database performance: Always start with EXPLAIN — most backend slowness is query-related
我的收藏