Skip to content

Commit

Permalink
[getsentry/action-github-commit] Auto commit
Browse files Browse the repository at this point in the history
  • Loading branch information
getsantry[bot] authored Dec 7, 2023
1 parent b4b23dd commit b39063b
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/docs/product/profiling/differential-flamegraphs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ Differential flamegraphs are graph visualizations that highlight how the call st

In Sentry, differential flamegraphs are shown whenever a function regression is detected. When a regression happens, Sentry generates two aggregate flamegraphs. One from the period leading up to the regression, and another from the time right after it. A differential flamegraph is then used to visualize the data.

![Differential flamegraph lock contention](./differential-flamegraph.png)

<Note>

In a differential flamegraph, the color red means that a function's execution time has increased or that there's a newly present function. The color blue means that the execution time has decreased.
In a differential flamegraph, the color red means that a function's execution time has increased or that there's a newly present function. The color blue means that the execution time has decreased.

</Note>

Be on the lookout for red frames when interpreting differential flamegraphs. They're the reason why your application code has been performing worse.

![Differential flamegraph lock contention](./differential-flamegraph.png)
The guiding principle when interpreting differential flamegraphs is to look for red frames - they are the reason why your application code has been performing worse.

The differential flamegraph above has highlighted that the function call to `ModuleLock.acquire` has increased in duration, which hints at a lock contention problem which is now slowing down our code.

Expand All @@ -33,20 +32,20 @@ We can see that new function calls to `OrganizationTeamsEndpoint.dispatch` were

If you followed closely, you might have noticed that the top right corner contains a `Before -> After` and `After -> Before` toggle. This is because by default, the differential flamegraphs draw the aggregate flamegraph from after the regression as the source of truth, which means that any code which might have been removed, will no longer be drawn (after all, it's not there anymore). This is why negating the view is useful, as it allows us to compare the data from before and peek into the future of how our code will change.

Here's an example of what our module lock problem looks like when using the profiling data from after the regression has occurred as the source of truth:
Let us see an example of how our module lock problem looks like when using the profiling data from after the regression as the source of truth:

![Differential flamegraph new functions](./differential-flamegraph-regular.png)

And here's what it looks like if we're using the data from before the regression occurred as our source of truth:
And now lets switch to using the data from before the regression as our source of truth

![Differential flamegraph new functions](./differential-flamegraph-inverted.png)

By using the `Before -> After` toggle we can see that `ModuleLock.acquire` was faster before the regression, but we can also see some of the function calls inside our `ChunkUploadEndpoint`, which are no longer being called.
We can see here that `ModuleLock.acquire` was faster before the regression, but we can also see some of the function calls inside our `ChunkUploadEndpoint`, which are no longer being called.

While differential flamegraphs in Sentry use a different color scheme and pull from a different source of data than regular flamegraphs, you can pan and zoom around the chart and search for frames the same way you do with regular flamegraph.
Besides the color scheme and a different source of data, differential flamegraphs follow a similar UI pattern as aggregated flamegraphs. You can pan/zoom around the chart and search for frames like in a regular flamegraph.

The table under the differential flamegraph shows both the largest increases and the largest decreases in function duration.
The table under the differential flamegraph represents the largest changes in function durations. The functions on the left have increased in duration while the functions on the right have improved in duration.

![Differential flamegraph table](./differential-flamegraph-table.png)

Differential flamegraphs are a good way to quickly visualize potential sources of performance regressions or improvements. Currently, they're only available as part of the automated function regression workflow, but we're working on adding them to other parts of the profiling workflow.
Differential flamegraphs are a powerful feature that allow us to quickly visualize potential sources of performance regressions or improvements and while they are currently only available as part of the automated function regression workflow, we will be adding them to other parts of the profiling workflow.

0 comments on commit b39063b

Please sign in to comment.