github.com/grafana/pyroscope@v1.18.0/docs/sources/shared/intro/profile-types-descriptions.md (about)

     1  ---
     2  headless: true
     3  description: Shared file for profile types.
     4  ---
     5  
     6  [//]: # 'Profile types descriptions.'
     7  [//]: # 'This shared file is included in these locations:'
     8  [//]: # '/pyroscope/docs/sources/introduction/profiling-types.md'
     9  [//]: # '/website/content/grafana-cloud/monitor-applications/profiles/introduction/profiling-types.md'
    10  [//]: #
    11  [//]: # 'If you make changes to this file, verify that the meaning and content are not changed in any place where the file is included.'
    12  [//]: # 'Any links should be fully qualified and not relative: /docs/grafana/ instead of ../grafana/.'
    13  
    14  <!-- Profile type descriptions -->
    15  
    16  ## CPU profiling
    17  
    18  CPU profiling measures the amount of CPU time consumed by different parts of your application code.
    19  High CPU usage can indicate inefficient code, leading to poor performance and increased operational costs.
    20  It's used to identify and optimize CPU-intensive functions in your application.
    21  
    22  - **When to use**: To identify and optimize CPU-intensive functions
    23  - **Flame graph insight**: The width of blocks indicates the CPU time consumed by each function
    24  
    25  The UI shows a spike in CPU along with the flame graph associated with that spike.
    26  You may get similar insights from metrics, however, with profiling, you have more details into the specific cause of a spike in CPU usage at the line level.
    27  
    28  ![Example flame graph](https://grafana.com/static/img/pyroscope/pyroscope-ui-single-2023-11-30.png)
    29  
    30  ## Memory allocation profiling
    31  
    32  Memory allocation profiling tracks the amount and frequency of memory allocations by the application.
    33  Excessive or inefficient memory allocation can lead to memory leaks and high garbage collection overhead, impacting application efficiency.
    34  
    35  <!-- vale Grafana.Spelling = NO -->
    36  - **Types**: Alloc Objects, Alloc Space
    37  <!-- vale Grafana.Spelling = YES -->
    38  - **When to use**: For identifying and optimizing memory usage patterns
    39  - **Flame graph insight**: Highlights functions where memory allocation is high
    40  
    41  The timeline shows memory allocations over time and is great for debugging memory related issues.
    42  A common example is when a memory leak is created due to improper handling of memory in a function.
    43  This can be identified by looking at the timeline and seeing a gradual increase in memory allocations that never goes down.
    44  This is a clear indicator of a memory leak.
    45  
    46  ![memory leak example](https://grafana.com/static/img/pyroscope/pyroscope-memory-leak-2023-11-30.png)
    47  
    48  Without profiling, this may be something that's exhibited in metrics or out-of-memory errors (OOM) logs but with profiling you have more details into the specific function that's allocating the memory which is causing the leak at the line level.
    49  
    50  ## Goroutine profiling
    51  
    52  Goroutines are lightweight threads in Go, used for concurrent operations.
    53  Goroutine profiling measures the usage and performance of these threads.
    54  Poor management can lead to issues like deadlocks and excessive resource usage.
    55  
    56  - **When to use**: Especially useful in Go applications for concurrency management
    57  - **Flame graph insight**: Provides a view of goroutine distribution and issues
    58  
    59  ## Mutex profiling
    60  
    61  Mutex profiling involves analyzing mutex (mutual exclusion) locks, used to prevent simultaneous access to shared resources.
    62  Excessive or long-duration mutex locks can cause delays and reduced application throughput.
    63  
    64  - **Types**: Mutex Count, Mutex Duration
    65  - **When to use**: To optimize thread synchronization and reduce lock contention
    66  - **Flame graph insight**: Shows frequency and duration of mutex operations
    67  
    68  ## Block profiling
    69  
    70  Block profiling measures the frequency and duration of blocking operations, where a thread is paused or delayed.
    71  Blocking can significantly slow down application processes, leading to performance bottlenecks.
    72  
    73  - **Types**: Block Count, Block Duration
    74  - **When to use**: To identify and reduce blocking delays
    75  - **Flame graph insight**: Identifies where and how long threads are blocked