Skip to content

Commit

Permalink
[DOC] Add intro material for Pyroscope (grafana#2839)
Browse files Browse the repository at this point in the history
* Add intro material

* Apply suggestions from code review

* Update content
  • Loading branch information
knylander-grafana authored Dec 13, 2023
1 parent f095b8d commit 31ec2d0
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 168 deletions.
27 changes: 24 additions & 3 deletions docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,33 @@ keywords:

![Grafana Pyroscope](logo.png)


<p align="center">Grafana Pyroscope is an open source software project for aggregating continuous profiling data. Continuous profiling is an
observability signal that allows you to understand your workload's resources (CPU, memory, etc...) usage down to the line number.</p>
Grafana Pyroscope is an open source software project for aggregating continuous profiling data.
Continuous profiling is an observability signal that allows you to understand your workload's resources (CPU, memory, etc.) usage down to the line number.

Grafana Pyroscope is fully integrated with Grafana allowing you to **correlate** with other observability signals, like metrics, logs, and traces.

## Continuous profiling

Continuous profiling is more than just a performance analysis tool.
It's a crucial component in modern software development and operations.
It goes past traditional profiling techniques by providing ongoing, in-depth insights into application performance.

Continuous profiling goes past the ephemeral, localized nature of traditional profiling (which historically has been more similar to `console.log` or `print statement` debugging) to a structured, centralized approach allows for effective use in production environments.
Put more simply, Pyroscope takes you from a bunch of flamegraph files on your desktop to a database where you can query and analyze production data in a structured way.

{{% admonition type="tip" %}}
To learn more about continuous profiling, read [the Introduction section]({{< relref "./introduction" >}}).
{{% /admonition %}}

Pyroscope, in particular, offers the flexibility to either visualize more traditional adhoc data or evolve your applications observability tooling to include more modern continuous profiling capabilities.


<video style="border-radius: 1%" autoplay loop>
<source src="ui.webm" type="video/webm">
</video>

## Features

Core features of Grafana Pyroscope include:

- **Easy to install:** Using its monolithic mode, you can get Grafana Pyroscope up and
Expand All @@ -43,3 +60,7 @@ Core features of Grafana Pyroscope include:
- **Natively multi-tenant:** Grafana Pyroscope's multi-tenant architecture enables you
to isolate data and queries from independent teams or business units, making it
possible for these groups to share the same database.

## Get started with Pyroscope

Begin your journey with Pyroscope. Visit our [Getting Started Guide](/docs/pyroscope/latest/get-started/) to learn about the different ways to instrument your application with Pyroscope. Join our [Slack community](https://grafana.slack.com/archives/C049PLMV8TB) and contribute to the evolving world of continuous profiling.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ description: How to use the Pyroscope UI to analyze performance of your applicat
weight: 40
keywords:
- pyroscope
- UI
- performance analysis
- flamegraphs
---
Expand Down Expand Up @@ -96,16 +95,4 @@ Using the same examples from above here is a diff between two label sets:
<!-- and a diff between two time periods during a introduction of a memory leak:
![memory leak](https://grafana.com/static/img/pyroscope/pyroscope-memory-leak-2023-11-30.png) -->

### Using Pyroscope within Grafana

One of the major benefits of Pyroscope is that it can be used alongside the other Grafana tools such as Loki, Tempo, Mimir, and k6. This allows you to use Pyroscope to get the most granular insight into your application and how you can use it to fix issues that you may have identified via metrics, logs, traces, or anything else.

You can use Pyroscope within Grafana by using the Pyroscope datasource plugin. This plugin allows you to query Pyroscope data from within Grafana and visualize it alongside your other Grafana data.

For example here is a screenshot of the explore page where we've combined traces and profiles to be able to see granular line-level detail when available for a trace span. This allows you to see the exact function that is causing a bottleneck in your application as well as a specific request.

![trace-profiler-view](https://grafana.com/static/img/pyroscope/pyroscope-trace-profiler-view-2023-11-30.png)

And here is an example of how you can integrate profiles into your dashboards. In this case we showing memory profiles alongside panels for logs and metrics to be able to debug OOM errors alongside the associated logs and metrics.

![dashboard](https://grafana.com/static/img/pyroscope/grafana-pyroscope-dashboard-2023-11-30.png)
35 changes: 35 additions & 0 deletions docs/sources/ingest-and-analyze-profile-data/pyroscope-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Use Pyroscope UI
menuTitle: Use the Pyroscope UI
description: How to use the Pyroscope UI to analyze performance of your applications.
weight: 40
keywords:
- pyroscope
- performance analysis
- flamegraphs
---

## Pyroscope: Continuous Profiling in Action

![Screenshots of Pyroscope's UI](https://grafana.com/static/img/pyroscope/pyroscope-ui-diff-2023-11-30.png)

Pyroscope's UI is designed to make it easy to visualize and analyze profiling data.
There are several different modes for viewing, analyzing, uploading, and comparing profiling data.
We will go into more detail about these modes in the [Pyroscope UI documentation].
For now, it's important to note that one of the major benefits of continuous profiling is the ability to compare and diff profiling data from two different queries:

- Comparing two different git commits before and after a code change
- Comparing Staging vs production environments to identify differences in performance
- Comparing performance between two different a/b tests or feature flag experiments
- Comparing memory allocations between two different time periods before and after a memory leak
- etc

With traditional profiling getting any of this information is much more difficult to organize, properly label, share, or store for later analysis. With Pyroscope, all of this is just a matter of writing the two queries you'd like to compare and clicking a button.

This UI will also expand over time to better help dig deeper into the data and provide more insights into your application.

## Seamless integration with observability tools

![Flowchart showing Pyroscope integration with other tools](https://grafana.com/static/img/pyroscope/grafana-pyroscope-dashboard-2023-11-30.png)

Pyroscope enhances its value through seamless integration with leading observability tools like Grafana, Prometheus, and Loki. This integration facilitates deeper insights into application performance and aids in addressing issues identified through other monitoring methods.
33 changes: 18 additions & 15 deletions docs/sources/introduction/_index.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
---
title: What is Pyroscope?
menuTitle: What is Pyroscope?
title: Introduction
menuTitle: Introduction
description: Learn about Pyrsocope and profiling.
weight: 10
draft: true
keywords:
- Pyroscope
- Profiling
---

<!-- This is placeholder page while we get the content written. -->

# What is Pyroscope?
# Introduction

<!-- The concept title is required. Use a noun-based title that includes the name of the product or feature. For example: Alerting fundamentals.
Grafana Pyroscope is a multi-tenant continuous profiling aggregation system, aligning its architectural design with Grafana Mimir, Grafana Loki, and Grafana Tempo. It facilitates the ingestion, storage, and querying of profiles and seamlessly integrates with Grafana, enabling a cohesive correlation of profiling data with existing metrics, logs, and traces.

A concept provides an overview and background information to help users understand a product, interface, or task. Concepts answer the question “what is it?”. Readers learn about features through concepts. Concepts do not include step-by-step procedures or reference material but often link to those materials.
Engineers utilizing Pyroscope gain the ability to delve deep into the performance attributes and resource demands of their applications. Boasting an intuitive interface coupled with a vivid data visualization, Pyroscope transforms raw profiling data into readily actionable insights.

Refer to the [Concept topic documentation](https://grafana.com/docs/writers-toolkit/writing-guide/topic-types/concept/) for guidelines on writing a concept topic.
-->
## Why Pyroscope

Introduce the concept.
Continuous profiling helps teams to quickly identify performance bottlenecks and optimize their applications.
With Grafana Pyroscope, teams can easily profile their applications in production with minimal overhead.
Starting with system-wide observability and drilling down to actionable code-level insights allows teams to identify performance issues in context no matter where they occur, so they can optimize their applications with precision.

<!-- The introduction is required. Add an introduction to the concept to summarize the purpose or main point of the feature. -->
## Core functionality

## Sections
With Pyroscope, you get access to the core profiling functionality, which you can use to find performance bottlenecks and optimize applications. The core functionality includes:

<!-- Add sections replacing **Sections** with subtitles for each section. Concept topics or sections explain what and why. They do not explain how. If you are a new user, you might look for concept information to learn about what Grafana is, why it might be useful to you, and what the general workflow is. -->
- Minimal CPU overhead and efficient compression ensure optimal performance.
- Architecture consistent with Loki, Mimir, and Tempo, promoting a smoother user experience.
- Horizontally scalable
- Reliable: Highly available setup ensures consistent uptime, even amidst upgrades or system failures.
- Multi-tenancy Support: makes it possible to run one database for multiple independent teams or business units.
- Cost Effective at Scale: Utilizes object storage, which allows extensive historical data storage without significant costs.
- Advanced Analysis UI: Provides an advanced UI, high-cardinality tag/label handling, and the ability to differentiate performance between tags/labels and time intervals.

## Useful links

<!-- Link out to task or reference topics related to the concept. -->
60 changes: 60 additions & 0 deletions docs/sources/introduction/continuous-profiling/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: When to use continuous profiling
menuTitle: When to use continuous profiling
description: Discover the benefits of continuous profiling and its role in modern application performance analysis.
weight: 20
keywords:
- pyroscope
- phlare
- continuous profiling
- flamegraphs
---

## When to use continuous profiling

**Continuous profiling** is a systematic method of collecting and analyzing performance data from production systems.

Traditionally, profiling has been used more as an ad-hoc debugging tool in languages like Go and Java.
You are probably used to running a benchmark tool locally and getting a pprof file in Go or maybe connecting into a misbehaving prod instance and pulling a flamegraph from a JFR file in Java.
This is great for debugging but not so great for production.

![example flamegraph](https://grafana.com/static/img/pyroscope/pyroscope-ui-single-2023-11-30.png)

Continuous profiling is a modern approach which is safer and more scalable for production environments.
It makes use of low overhead sampling to collect profiles from production systems and stores them in a database for later analysis.
You can get a more holistic view of your application and how it behaves in production.

## Benefits

![Diagram showing 3 benefits of continuous profiling](https://grafana.com/static/img/pyroscope/profiling-use-cases-diagram.png)

Why prioritize continuous profiling?

1. **In-Depth Code Insights:** It provides granular, line-level insights into how application code utilizes resources, offering the most detailed view of application performance.
2. **Complements Other Observability Tools:** Continuous profiling fills critical gaps left by metrics, logs, and tracing, creating a more comprehensive observability strategy.
3. **Proactive Performance Optimization:** Regular profiling enables teams to proactively identify and resolve performance bottlenecks, leading to more efficient and reliable applications.

## Use cases

![Infographic illustrating key business benefits](https://grafana.com/static/img/pyroscope/cost-cutting-diagram.png)

Adopting continuous profiling with tools like Pyroscope can lead to significant business advantages:

1. **Reduced operational costs:** Optimization of resource usage can significantly cut down cloud and infrastructure expenses
2. **Reduced latency:** Identifying and addressing performance bottlenecks leads to faster and more efficient applications
3. **Enhanced incident management:** Faster problem identification and resolution, reducing Mean Time to Resolution (MTTR) and improving end-user experience

### Reduce operational costs

Pyroscope's low-overhead profiling enables precise optimization of resource usage, directly impacting various cost centers in technology infrastructure.
By providing in-depth insights into application performance, Pyroscope allows teams to identify and eliminate inefficiencies, leading to significant savings in areas like observability, incident management, messaging/queuing, deployment tools, and infrastructure.

### Reduced latency

Pyroscope plays a pivotal role in reducing application latency by identifying performance bottlenecks at the code level.
This granular insight allows for targeted optimization, leading to faster application response times, improved user experience, and consequently, better business outcomes like increased customer satisfaction and revenue.

### Enhanced incident management

Pyroscope streamlines incident management by offering immediate, actionable insights into application performance issues.
With continuous profiling, teams can quickly pinpoint the root cause of an incident, reducing the mean time to resolution (MTTR) and enhancing overall system reliability and user satisfaction.
37 changes: 37 additions & 0 deletions docs/sources/introduction/flamegraphs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: "Flamegraphs: Visualizing performance data"
menuTitle: Flamegraphs
description: Learn about flamegraphs to help visualize performance data
weight: 100
keywords:
- Pyroscope
- Profiling
---

# Flamegraphs: Visualizing performance data

A fundamental aspect of continuous profiling is the flamegraph, a convenient way to visualize performance data.
These graphs provide a clear, intuitive understanding of resource allocation and bottlenecks within the application. Pyroscope extends this functionality with additional visualization formats like tree graphs and top lists.

## How is a flamegraph created?

![code to flamegraph diagram](https://grafana.com/static/img/pyroscope/code-to-flamegraph-animation.gif)

This diagram shows how code is turned into a flamegraph. In this case Pyroscope would sample the stacktrace of your application to understand how many CPU cycles are being spent in each function. It would then aggregate this data and turn it into a flamegraph. This is a very simplified example but it gives you an idea of how Pyroscope works.

## What does a flamegraph represent?

![flamegraph](https://grafana.com/static/img/pyroscope/pyroscope-flamegraph-2023-11-30.png)

Horizontally, the flamegraph represents 100% of the time that this application was running.
The width of each node represents the amount of time spent in that function.
The wider the node, the more time spent in that function. The narrower the node, the less time spent in that function.

Vertically, the nodes in the flamegraph represent the heirarchy of which functions were called and how much time was spent in each function.
The top node is the root node and represents the total amount of time spent in the application.
The nodes below it represent the functions that were called and how much time was spent in each function.
The nodes below those represent the functions that were called from those functions and how much time was spent in each function.
This continues until you reach the bottom of the flamegraph.

This is a CPU profile, but profiles can represent many other types of resource such as memory, network, disk, etc.
To understand more about how to read a flamegraph, what the different colors mean, and what other types of profiles exist and when to use them see our flamegraph documentation or [profile types documentation](/docs/pyroscope/next/analyzing-profiles-in-pyroscope-ui/)
Loading

0 comments on commit 31ec2d0

Please sign in to comment.