Compare with Diff flame graph
Now compare the high-CPU region (eu-west-1) to a lower-CPU one (ap-south-1) with Diff flame graph. Put the behavior you expect on Baseline and what you’re investigating on Comparison.
The view merges both profiles. It compares each function’s share of each side’s total time, not absolute time, so the two sides stay comparable even if they did different amounts of work. Width is both profiles combined; color is what changed. Red is a larger share in the comparison, green a smaller share (blue in the colorblind scheme), and gray little or no change. Searching also grays out functions that don’t match. Stronger color means a bigger relative change.
Hover a function or read the table for Baseline and Comparison as % of each side’s total. In the table, Diff is the relative change between them; it reads new when the function is absent from the baseline and removed when it’s absent from the comparison.
You can also open Diff flame graph from the tabs and set region filters yourself. Here, you’ll select them on the region panels instead.
To use Diff flame graph, complete the following steps:
Return to the Labels view with region filtered. If you already see the region panel with Select, or the per-region panels, click Skip.
Click Select on the region panel so each region has its own panel. If the per-region panels are already open, click Skip.
Assign the high-CPU region as Comparison and a lower-CPU region as Baseline.
On the
eu-west-1panel, select Comparison.On the
ap-south-1panel, select Baseline.
Click Compare to open the Diff flame graph view for the two regions.
You can click and drag on the Baseline and Comparison graphs to highlight the time ranges you want to diff. For this path, click Auto-select to pick windows for you.
In the table search bar, type
mainto filter the function list.You can see that
PlaceOrdercallsprocessOrder, which callsvalidateOrderWithRegexp. Hover overvalidateOrderWithRegexpand check its Baseline and Comparison percentages.ap-south-1spends no time there, so Baseline is 0% and the table marks the function new. That regex work exists only ineu-west-1, which confirms it as the cause of the increased CPU usage.
You’ve found the function responsible for the higher CPU usage in eu-west-1. Next is an optional AI look at Diff flame graph.