Performance Bottleneck Profiling: Node, Python, Go

Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.

Development / Engineeringperformanceprofiling
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“My Node.js API endpoint is slow, profile it and find bottlenecks”
Beforegeneric AI agent
Node performance issues can come from a lot of places—CPU, memory, I/O, database queries, all of that. I'd recommend starting by checking your server logs for error patterns, then maybe using a profiler to see where time is actually being spent. You could also look at database query performance if you're doing data operations. But without seeing the actual code or metrics, it's hard to know where to start. Do you have access to any monitoring data?
Afterwith Performance Bottleneck Profiling: Node, Python, Go
PERFORMANCE PROFILING REPORT

BASELINE METRICS
• Endpoint: GET /api/user/:id/analytics
• Current latency: 2,847ms (p95)
• Requests per second: 12
• Memory usage: 280 MB (heap)
• Error rate: 0.3%

PROFILING RESULTS

CPU FLAMEGRAPH ANALYSIS
Hotspots identified:
1. Database query executor: 42% of time
   → SELECT * query fetching 150k+ rows unnecessarily
   → Missing index on user_id + date columns
2. JSON serialization: 28% of time
   → Stringifying entire user object (1000+ fields)
3. Authentication middleware: 18% of time
   → Token verification running on every field resolver
4. Other overhead: 12%

MEMORY PROFILING
• Heap snapshots show 45 MB leaking per 1000 requests
• Root cause: Cached query results never cleared
• Event emitter listeners stacking (900+ listeners on single event)

DATABASE QUERY ANALYSIS
• Slow query: 2.1 seconds average (SELECT * from users)
• Query plan shows full table scan (no index used)
• Missing index on user_id would reduce to 8ms
• N+1 problem: 156 queries per request (should be 4)

BUNDLE SIZE & LOAD TIME
• Initial bundle: 2.8 MB (unoptimized)
• Tree-shaking opportunities: 420 KB unused code
• Parse time: 340ms on cold start

BEFORE & AFTER OPTIMIZATION
Before: 2,847ms p95 latency | 280 MB heap | 12 RPS

Optimization plan:
1. Add database index on user_id + date (reduces query to 8ms)
2. Implement query result caching (60-second TTL)
3. Lazy-load user fields (fetch only needed 20 fields)
4. Remove duplicate token verification middleware
5. Enable tree-shaking in bundle (remove 420 KB unused code)

Expected After: 240ms p95 latency | 120 MB heap | 95 RPS
Improvement: 91% latency reduction, 57% memory reduction

About this skill

Your endpoint is slow, p99 spikes under load, or memory climbs until the pod OOMs. Plain advice says "add a cache" or "add an index" before anyone has looked at a profile. This skill first works out what kind of slowness you have. It then gives you the profiler that can actually see it, reads the output with you, and proves the fix with tail-latency numbers taken under the same conditions as the baseline.

What it does

  • Sorts the problem into one class (CPU-bound, waiting on I/O, lock or pool contention, GC or memory pressure, queueing) so you don't stare at an empty CPU flamegraph for a database wait
  • Gives exact capture commands for Node (--cpu-prof, 0x, heap snapshots, event-loop delay), Python (py-spy, pyinstrument, memray, tracemalloc), and Go (pprof CPU, heap, goroutine, block, and mutex profiles)
  • Reads pasted flamegraphs, pprof output, EXPLAIN ANALYZE plans, and heap diffs, and names the hot frame and its share of time
  • Separates real leaks from normal growth using a three-snapshot diff, and checks RSS against heap and fragmentation
  • Writes k6 or Artillery load tests with an arrival-rate model, thresholds, and a pass/fail definition, so the tail latency isn't hidden
  • Pushes back on fixes that Amdahl's law says can't matter and on profiling dev builds

What you get

A diagnosis, which covers the classification, capture commands, what to look for, and the finding. Then the narrowest fix and a verification plan that compares p50, p95, p99, throughput, errors, and peak memory before and after.

Best for

Backend and full-stack engineers, SREs, and tech leads chasing slow endpoints, memory leaks, or performance regressions in Node.js, Python, or Go services.

SKILL.md preview

SKILL.md
---
name: performance-bottleneck-profiling

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

Featured in

More development skills

View all Development skills →