Automating Performance Engineering with AI Agents

AI Engineergo watch the original →

Netflix uses AI agents to analyze production call stacks, identify performance antipatterns, and generate verified code fixes, shifting from manual profiling to an automated, catalog-driven optimization loop.

The Bottleneck of Manual Profiling

Performance engineering is traditionally a high-friction, manual process. Engineers must trigger profiling, download raw data, visualize call stacks, and hunt for bottlenecks—a process that is time-consuming and often reactive, usually triggered only during production incidents. As AI-assisted coding increases the velocity of code production, this manual bottleneck becomes unsustainable, leading to "performance debt" where inefficient code accumulates faster than it can be audited.

The Agentic Optimization Loop

Netflix implemented an AI agent to automate this lifecycle. The agent consumes profiling data (call stacks) from production services, identifies known antipatterns (like quadratic-time loops or redundant object allocations), and traces these back to the specific source lines. By leveraging the fact that profilers output structured data regardless of the language (Java, Go, Python), the agent can identify hot paths and propose specific code optimizations. The agent then clones the relevant repository, applies the fix, and generates a code review.

Verification and Guardrails

To mitigate the risk of automated changes, the system enforces a strict verification pipeline. Before a human ever sees a code review, the agent must pass existing unit and integration tests. Crucially, the agent performs a canary deployment, splitting real production traffic between the baseline and the optimized code. It then generates an observability report comparing CPU usage, latency, and error rates. The human engineer acts as the final gatekeeper, reviewing the agent's proposed fix and the canary results before merging.

Scaling via Pattern Catalogs

Rather than treating each optimization as a one-off, Netflix aggregates findings into a centralized, version-controlled "pattern catalog" (stored as markdown). This catalog acts as a shared memory for the organization. When one service identifies an antipattern, the catalog is updated, allowing future agents to proactively flag or fix the same issue across other services. This shifts the strategy from reactive (fixing production issues) to proactive (catching antipatterns during the initial code review process).

Notable Quotes

  • "The AI agent ships code; it is pretty much tuned to ship code fast... but your agent doesn't know specific details about your platforms and your frameworks."
  • "The profiling data that it needs to read is actually very well structured... it knows the meaning of these functions and when it sees it is being used in a poor way it can actually identify that this is a quadratic algorithm."
  • "Profiler gives the estimate, canary gives ground truth."
  • "You want to move closer and closer to the proactive path where... the reviewer agent could actually look up that catalog and provide an inline comment... before the code ships at all."
  • #ai-agents
  • #performance-engineering
  • #sdlc
  • #observability

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.