> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/view-resource-utilization-metrics.md).

# View CPU and memory utilization metrics

View CPU and memory utilization metrics during a build on Harness Cloud.

Harness CI provides real-time visibility into resource utilization during CI stage execution. This feature helps you understand how your builds consume CPU and memory resources, enabling you to optimize resource allocation and troubleshoot performance issues.

{% hint style="info" %}
**Cloud-only availability**

This feature is **only available for CI stages running on Harness Cloud** build infrastructure across **Linux**, **macOS**, and **Windows** platforms. It is not supported on self-managed build infrastructures.
{% endhint %}

{% hint style="info" %}
**Feature flag required**

This feature requires the `CI_CPU_MEMORY_INSIGHTS` feature flag. To enable it, contact [Harness Support](mailto:support@harness.io).
{% endhint %}

### What you will learn from this topic

By the end of this topic, you will be able to:

* Access resource metrics for a completed or running build
* Interpret real-time and summary metrics
* Use metrics to optimize resource allocation and troubleshoot performance issues

### Before you begin

Before you view resource metrics, ensure you have the following:

* Use a CI stage that runs on Harness Cloud.
* Confirm that Harness enables the `CI_CPU_MEMORY_INSIGHTS` feature flag for your account.

### Access resource metrics <a href="#access-resource-metrics" id="access-resource-metrics"></a>

To view resource utilization metrics for a pipeline execution:

1. Go to **Builds**, then select a completed or running build.
2. Select the stage that ran on Harness Cloud infrastructure.
3. In the execution view, locate the **resource info button** in the stage header. The button displays the platform and resource class, such as **Linux (Large)** or **Windows (Medium)**.

   ![Resource info button](https://4226796345-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqKtVmwAGTfGQS1MVC97G%2Fuploads%2Fgit-blob-b36cfca4f6d46ec6b088835bc2ae58e37768da74%2Fresource-utilization-button.png?alt=media)
4. Select the button to open the **Resource Insights** panel.

### Understand the metrics <a href="#understanding-the-metrics" id="understanding-the-metrics"></a>

The **Resource Insights** panel displays real-time and summary metrics for your build execution.

#### Real-time metrics <a href="#real-time-metrics" id="real-time-metrics"></a>

During pipeline execution, metrics are collected periodically and displayed as interactive charts:

| Metric           | Description                          |
| ---------------- | ------------------------------------ |
| **CPU Usage**    | Percentage of CPU utilized over time |
| **Memory Usage** | Memory consumption in GB over time   |

![Resource metrics charts](https://4226796345-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqKtVmwAGTfGQS1MVC97G%2Fuploads%2Fgit-blob-5ff7cf06551eae056b6065b04b0cbdad7352beb6%2Fresource-metrics-charts.png?alt=media)

#### Summary metrics <a href="#summary-metrics" id="summary-metrics"></a>

After the pipeline completes, summary statistics are calculated to help you understand overall resource consumption:

| Metric               | Description                                                              |
| -------------------- | ------------------------------------------------------------------------ |
| **Peak Usage**       | Maximum resource utilization during execution                            |
| **Avg. Utilization** | Mean resource utilization across the entire execution                    |
| **P50**              | 50th percentile (median) usage                                           |
| **P90**              | 90th percentile usage; 90% of the time, usage was at or below this value |
| **P95**              | 95th percentile usage                                                    |
| **P99**              | 99th percentile usage                                                    |

{% hint style="info" %}
**UNDERSTANDING PERCENTILE METRICS**

Percentile metrics are useful for capacity planning. For example, P90 tells you that 90% of your build time had resource usage at or below this level, filtering out brief spikes that might skew the average.
{% endhint %}

![P90 summary metrics](https://4226796345-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqKtVmwAGTfGQS1MVC97G%2Fuploads%2Fgit-blob-045400549b7dcbbec904512f03f832e5839ea906%2Fresource-p90-summary.png?alt=media)

### Use cases <a href="#use-cases" id="use-cases"></a>

#### Right-size your resource class <a href="#right-size-your-resource-class" id="right-size-your-resource-class"></a>

If your P90 CPU or memory usage is consistently low (for example, below 30%), consider using a smaller resource class to reduce costs. Conversely, if you see frequent spikes near 100%, upgrading to a larger resource class may improve build performance.

Go to [Use Harness Cloud build infrastructure](/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure.md#platforms-and-resource-classes) to view available resource classes.

#### Diagnose slow builds <a href="#diagnose-slow-builds" id="diagnose-slow-builds"></a>

High CPU or memory utilization during specific steps can indicate:

* Resource-intensive operations that might benefit from optimization
* Memory leaks in test suites
* Inefficient parallel execution configurations

#### Identify OOM risks <a href="#identify-oom-risks" id="identify-oom-risks"></a>

If memory usage approaches the resource class limit, your build may be at risk of Out of Memory (OOM) failures. The metrics help you proactively identify and address these issues before they cause build failures.

### Data retention <a href="#data-retention" id="data-retention"></a>

Resource utilization metrics are available for up to **30 days** from the pipeline execution date, consistent with the default execution data retention period.

### Metrics data <a href="#metrics-data" id="metrics-data"></a>

The following metrics are collected during CI stage execution:

| Field            | Unit  | Description                   |
| ---------------- | ----- | ----------------------------- |
| Total Memory     | GB    | Total available system memory |
| Available Memory | GB    | Free memory at each sample    |
| Total CPU        | Cores | Number of CPU cores           |
| Available CPU    | %     | Unused CPU percentage         |

### Next steps <a href="#see-also" id="see-also"></a>

* [Use Harness Cloud build infrastructure](/continuous-integration/use-harness-ci/use-harness-ci/set-up-build-infrastructure/use-harness-cloud-build-infrastructure.md): Configure CI stages that run on Harness Cloud.
* [Harness CI Intelligence](/continuous-integration/use-harness-ci/use-harness-ci/harness-ci-intelligence.md): Review CI Intelligence capabilities.
* [Troubleshoot CI](/continuous-integration/troubleshooting-and-resources/troubleshoot-harness-ci/troubleshooting-ci.md): Diagnose CI issues.

{% @harness-feedback/feedback %}
