

# Metrics analyzed by AWS Compute Optimizer
<a name="metrics"></a>

After you [opt in](getting-started.md), AWS Compute Optimizer analyzes the specifications, such as vCPUs, memory, or storage, and the Amazon CloudWatch metrics of your running resources from a period over the last 14 days. If you activate the [enhanced infrastructure metrics recommendation preference](enhanced-infrastructure-metrics.md), AWS Compute Optimizer analyzes your resources for up to 93 days. 

The analysis can take up to 24 hours to complete. When the analysis is complete, the findings are displayed on the dashboard page of the Compute Optimizer console. For more information, see [Using the AWS Compute Optimizer dashboard](viewing-dashboard.md).

**Note**  
To generate recommendations for Amazon EC2 instances, EC2 Auto Scaling groups, Amazon EBS volumes, Lambda functions, and commercial software licenses, Compute Optimizer uses the maximum utilization point within each five-minute time interval over the lookback period. For ECS services on Fargate recommendations, Compute Optimizer uses the maximum utilization point within each one-minute time interval.
AWS might use your utilization data to help improve the overall quality of Compute Optimizer's recommendations. To stop AWS using your utilization data, contact [AWS Support](https://console.aws.amazon.com/support).

**Topics**
+ [EC2 instance metrics](ec2-metrics-analyzed.md)
+ [EBS volume metrics](ebs-metrics-analyzed.md)
+ [Lambda function metrics](lambda-metrics-analyzed.md)
+ [Metrics for Amazon ECS services on Fargate](ecs-fargate-metrics-analyzed.md)
+ [Metrics for commercial software licenses](license-metrics-analyzed.md)
+ [Aurora and RDS database metrics](rds-metrics-analyzed.md)

# EC2 instance metrics
<a name="ec2-metrics-analyzed"></a>

**Topics**
+ [Metrics analyzed for EC2 instances](#ec2-metrics-list)
+ [Enabling memory utilization with the CloudWatch agent](#cw-agent)
+ [Enabling NVIDIA GPU utilization with the CloudWatch agent](#nvidia-cw-agent)
+ [Configure external metrics ingestion](#external-metrics)

## Metrics analyzed for EC2 instances
<a name="ec2-metrics-list"></a>

Compute Optimizer analyzes the following CloudWatch metrics of your EC2 instances, including instances that are part of EC2 Auto Scaling groups.


| Metric | Description | 
| --- | --- | 
|  CPUUtilization  |  The percentage of allocated EC2 compute units that are in use on the instance. This metric identifies the processing power that's required to run an application on an instance.  | 
|  MemoryUtilization  |  The percentage of memory that's used during the sample period. This metric identifies the memory that's required to run an application on an instance. Memory utilization metrics are analyzed for the following resources: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/compute-optimizer/latest/ug/ec2-metrics-analyzed.html)  | 
|  GPUUtilization  |  The percentage of allocated GPUs that are currently in use on the instance.  To allow Compute Optimizer analyze the GPU utilization metric of your instances, install the CloudWatch agent on your instances. For more information, see [Enabling NVIDIA GPU utilization with the CloudWatch agent](#nvidia-cw-agent).   | 
|  GPUMemoryUtilization  |  The percentage of total GPU memory that's currently in use on the instance.  | 
|  GPUEncoderStatsSessionCount  |  The number of active encoding sessions on an NVIDIA GPU.  | 
|  NetworkIn  |  The number of bytes that's received on all network interfaces by the instance. This metric identifies the volume of incoming network traffic to an instance.  | 
|  NetworkOut  |  The number of bytes that are sent out on all network interfaces by the instance. This metric identifies the volume of outgoing network traffic from an instance.  | 
|  NetworkPacketsIn  |  The number of packets that are received by the instance.  | 
|  NetworkPacketsOut  |  The number of packets that are sent out by the instance.  | 
|  DiskReadOps  |  The read operations per second of the instance store volume of the instance.  | 
|  DiskWriteOps  |  The write operations per second of the instance store volume of the instance.  | 
|  DiskReadBytes  |  The read bytes per second of the instance store volume of the instance.  | 
|  DiskWriteBytes  |  The write bytes per second of the instance store volume of the instance.  | 
|  VolumeReadBytes  |  The read bytes per second of EBS volumes attached to the instance. Displayed as KiBs in the console.  | 
|  VolumeWriteBytes  |  The write bytes per second of EBS volumes attached to the instance. Displayed as KiBs in the console.  | 
|  VolumeReadOps  |  The read operations per second of EBS volumes attached to the instance.  | 
|  VolumeWriteOps  |  The write operations per second of EBS volumes attached to the instance.  | 

For more information about instance metrics, see [List the available CloudWatch metrics for your instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/viewing_metrics_with_cloudwatch.html) in the *Amazon Elastic Compute Cloud User Guide*. For more information about EBS volume metrics, see [Amazon CloudWatch metrics for Amazon EBS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cloudwatch_ebs.html) in the *Amazon Elastic Compute Cloud User Guide*.

## Enabling memory utilization with the CloudWatch agent
<a name="cw-agent"></a>

To have Compute Optimizer analyze the memory utilization metric of your instances, install the CloudWatch agent on your instances. Enabling Compute Optimizer to analyze memory utilization data for your instances provides an additional measurement of data that further improves Compute Optimizer's recommendations. For more information about installing the CloudWatch agent, see [Collecting Metrics and Logs from Amazon EC2 Instances and On-Premises Servers with the CloudWatch agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html) in the *Amazon CloudWatch User Guide*.

On Linux instances, Compute Optimizer analyses the `mem_used_percent` metric in the `CWAgent` namespace, or the legacy `MemoryUtilization` metric in the `System/Linux` namespace. On Windows instances, Compute Optimizer analyses the `Available MBytes` metric in the `CWAgent` namespace. If both the `Available MBytes` and `Memory % Committed Bytes In Use` metrics are configured in the `CWAgent` namespace, Compute Optimizer chooses `Available MBytes` as the primary memory metric to generate recommendations.

**Note**  
We recommend that you configure the `CWAgent` namespace to use `Available MBytes` as your memory metric for Windows instances.
Compute Optimizer also supports the `Available KBytes` and `Available Bytes` metrics, and prioritizes both over the `Memory % Committed Bytes In Use` metric when generating recommendations for Windows instances.

Additionally, the namespace must contain the `InstanceId` dimension. If the `InstanceId` dimension is missing or you overwrite it with a custom dimension name, Compute Optimizer can't collect memory utilization data for your instance. Namespaces and dimensions are defined in the CloudWatch agent configuration file. For more information, see [Create the CloudWatch agent Configuration File](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-cloudwatch-agent-configuration-file.html) in the *Amazon CloudWatch User Guide*.

**Important**  
All of the CloudWatch namespaces and metric names are case sensitive.

**Example: CloudWatch agent configuration for memory collection**

```
{
    "agent": {
        "metrics_collection_interval": 60,
        "run_as_user": "root"
    },
    "metrics": {
        "namespace": "CWAgent",
        "append_dimensions": {
            "InstanceId": "${aws:InstanceId}"
        },
        "metrics_collected": {
            "mem": {
                "measurement": [
                    "mem_used_percent"
                ],
                "metrics_collection_interval": 60
            }
        }
    }
}
```

## Enabling NVIDIA GPU utilization with the CloudWatch agent
<a name="nvidia-cw-agent"></a>

To allow Compute Optimizer to analyze the NVIDIA GPU utilization metric of your instances, do the following:

1. Install the CloudWatch agent on your instances. For more information, see [Installing the CloudWatch agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-EC2-Instance.html) in the *Amazon CloudWatch User Guide*.

1. Allow the CloudWatch agent to collect NVIDIA GPU metrics. For more information, see [Collect NVIDIA GPU metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-NVIDIA-GPU.html) in the *Amazon CloudWatch User Guide*.

Compute Optimizer analyzes the following NVIDIA GPU metrics:
+ `nvidia_smi_utilization_gpu`
+ `nvidia_smi_memory_used`
+ `nvidia_smi_encoder_stats_session_count`
+ `nvidia_smi_encoder_stats_average_fps`
+ `nvidia_smi_encoder_stats_average_latency`
+ `nvidia_smi_temperature_gpu`

The namespace must contain the `InstanceId` dimension and `index` dimensions. If the dimensions are missing or you overwrite them with a custom dimension name, Compute Optimizer can't collect GPU utilization data for your instance. Namespaces and dimensions are defined in the CloudWatch agent configuration file. For more information, see [Create the CloudWatch agent Configuration File](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/create-cloudwatch-agent-configuration-file.html) in the *Amazon CloudWatch User Guide*.

## Configure external metrics ingestion
<a name="external-metrics"></a>

You can use the external metrics ingestion feature to configure AWS Compute Optimizer to ingest EC2 memory utilization metrics from one of the four observability products: Datadog, Dynatrace, Instana, and New Relic. When you enable external metrics ingestion, Compute Optimizer analyzes your external EC2 memory utilization metrics in addition to your CPU, disk, network, IO, and throughput data to generate EC2 rightsizing recommendations. These recommendations can provide you with additional savings and enhanced performance. For more information, see [External metrics ingestion](external-metrics-ingestion.md).

# EBS volume metrics
<a name="ebs-metrics-analyzed"></a>

Compute Optimizer analyzes the following CloudWatch metrics of your EBS volumes.


| Metric | Description | 
| --- | --- | 
|  VolumeReadBytes  |  The read bytes per second of the EBS volume.  | 
|  VolumeWriteBytes  |  The write bytes per second of the EBS volume.  | 
|  VolumeReadOps  |  The read operations per second of the EBS volume.  | 
|  VolumeWriteOps  |  The write operations per second of the EBS volume.  | 

For more information about these metrics, see [Amazon CloudWatch metrics for Amazon EBS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using_cloudwatch_ebs.html) in the *Amazon Elastic Compute Cloud User Guide*.

# Lambda function metrics
<a name="lambda-metrics-analyzed"></a>

Compute Optimizer analyzes the following CloudWatch metrics of your Lambda functions.


| Metric | Description | 
| --- | --- | 
|  Invocations  |  The number of times your function code is executed, including successful executions and executions that result in a function error.  | 
|  Duration  |  The amount of time that your function code spends processing an event.  | 
|  Errors  |  The number of invocations that result in a function error. Function errors include exceptions thrown by your code and exceptions thrown by the Lambda runtime. The runtime returns errors for issues such as timeouts and configuration errors.  | 
|  Throttles  |  The number of invocation requests that are throttled.  | 

For more information about these metrics, see [Working with AWS Lambda function metrics](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html) in the *AWS Lambda Developer Guide*.

In addition to these metrics, Compute Optimizer analyzes the memory utilization of your function during the look-back period. For more information about memory utilization for Lambda functions, see [Understanding AWS Lambda behavior using Amazon CloudWatch Logs Insights](https://aws.amazon.com//blogs/mt/understanding-aws-lambda-behavior-using-amazon-cloudwatch-logs-insights/) in the *AWS Management & Governance Blog* and [Using Lambda Insights in CloudWatch](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-insights.html) in the *AWS Lambda Developer Guide*.

# Metrics for Amazon ECS services on Fargate
<a name="ecs-fargate-metrics-analyzed"></a>

Compute Optimizer analyzes the following CloudWatch and Amazon ECS utilization metrics of your Amazon ECS services on Fargate.


| Metric | Description | 
| --- | --- | 
|  CPUUtilization  |  The percentage of CPU capacity that's used in the service.  | 
|  MemoryUtilization  |  The percentage of memory that's used in the service.  | 

For more information about these metrics, see [Amazon ECS CloudWatch metrics](https://docs.aws.amazon.com//AmazonECS/latest/userguide/cloudwatch-metrics.html) in the *Amazon ECS User Guide for AWS Fargate*.

# Metrics for commercial software licenses
<a name="license-metrics-analyzed"></a>

Compute Optimizer analyzes the following metric to generate recommendations for commercial software licenses.

**`mssql_enterprise_features_used`** — the number of Microsoft SQL Server Enterprise edition features in use. The features are as follows:
+ More than 128GB of memory for the buffer pool extension
+ More than 48 vCPUs
+ Always On availability groups with more than 1 database
+ Asynchronous commit replicas
+ Read-only replicas
+ Asynchronous database mirroring
+ `tempdb` memory-optimized metadata is enabled
+ R or Python extensions
+ Peer-to-peer replication
+ Resource Governor

# Aurora and RDS database metrics
<a name="rds-metrics-analyzed"></a>

Compute Optimizer analyzes the following CloudWatch metrics of your Amazon Aurora and RDS databases.

------
#### [ RDS DB instances ]

Compute Optimizer analyzes the following CloudWatch metrics of your Amazon RDS DB instances.


| Metric | Description | 
| --- | --- | 
|  CPUUtilization  |  The percentage of allocated compute units that are in use on the DB instance. This metric identifies the processing power that's required to run an application on an instance.  | 
|  DatabaseConnections  |  The number of client sessions that are connected to the DB instance.  | 
|  NetworkReceiveThroughput  |  The incoming (receive) network traffic on the DB instance, including both customer database traffic and Amazon RDS traffic used for monitoring and replication.  | 
|  NetworkTransmitThroughput  |  The outgoing (transmit) network traffic on the DB instance, including both customer database traffic and Amazon RDS traffic used for monitoring and replication.  | 
|  ReadIOPS  |  The average number of disk read I/O operations per second.  | 
|  WriteIOPS  |  The average number of disk write I/O operations per second.  | 
|  ReadThroughput  |  The average number of bytes read from disk per second.  | 
|  WriteThroughput  |  The average number of bytes written to disk per second.  | 
|  EBSIOBalance%  |  The percentage of I/O credits remaining in the burst bucket of your RDS database. This metric is available for basic monitoring only.  | 
|  EBSByteBalance%  |  The percentage of throughput credits remaining in the burst bucket of your RDS database. This metric is available for basic monitoring only.  | 
|  FreeStorageSpace  |  The amount of available storage space.  | 

If you enabled Amazon RDS Performance Insights, Compute Optimizer also analyzes the following metrics of your Amazon RDS DB instance. To enable Performance Insights for your DB instances, see [ Turning Performance Insights on and off for Amazon RDS](https://docs.aws.amazon.com//AmazonRDS/latest/UserGuide/USER_PerfInsights.Enabling.html) in the *Amazon Relational Database Service User Guide*.

**Note**  
If Performance Insights isn’t enabled, Compute Optimizer doesn’t provide recommendations to reduce vCPU capacity.


| Metric | Description | 
| --- | --- | 
|  DBLoad  |  The level of session activity in your database. For more information, see [ Database load](https://docs.aws.amazon.com//AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the *Amazon Relational Database Service User Guide*.  | 
|  os.swap.in  |  The amount of memory, in kilobytes, swapped in from disk.  | 
|  os.swap.out  |  The amount of memory, in kilobytes, swapped out to disk.  | 

For more information about Amazon RDS metrics, see [ Metrics reference for Amazon RDS](https://docs.aws.amazon.com//AmazonRDS/latest/UserGuide/metrics-reference.html) in the *Amazon Relational Database Service User Guide*.

------
#### [ Aurora DB instances ]

Compute Optimizer analyzes the following CloudWatch metrics of your Amazon Aurora DB instances.


| Metric | Description | 
| --- | --- | 
|  CPUUtilization  |  The percentage of CPU used by an Aurora DB instance.  | 
|  DatabaseConnections  |  The number of client network connections to the database instance.  | 
|  NetworkReceiveThroughput  |  The amount of network throughput received from clients by each instance in the Aurora DB cluster. This throughput doesn't include network traffic between instances in the Aurora DB cluster and the cluster volume.  | 
|  NetworkTransmitThroughput  |  The amount of network throughput sent to clients by each instance in the Aurora DB cluster. This throughput doesn't include network traffic between instances in the DB cluster and the cluster volume.  | 
|  StorageNetworkReadThroughput  |  The amount of network throughput received from the Aurora storage subsystem by each instance in the DB cluster.  | 
|  StorageNetworkWriteThroughput  |  The amount of network throughput sent to the Aurora storage subsystem by each instance in the Aurora DB cluster.  | 
|  AuroraMemoryHealthState  |  Indicates the memory health state. A value of `0` equals `NORMAL`. A value of `10` equals `RESERVED`, which means that the server is approaching a critical level of memory usage.   This metric applies to Aurora MySQL only.   | 
|  AuroraMemoryNumDeclinedSqlTotal  |  The total number of queries declined as part of out-of-memory (OOM) avoidance.  This metric applies to Aurora MySQL only.   | 
|  AuroraMemoryNumKillConnTotal  |  The total number of connections closed as part of OOM avoidance.  This metric applies to Aurora MySQL only.   | 
|  AuroraMemoryNumKillQueryTotal  |  The total number of queries ended as part of OOM avoidance.  This metric applies to Aurora MySQL only.   | 
|  ReadIOPSEphemeralStorage  |  The average number of disk read I/O operations to Ephemeral NVMe storage.  This metric applies to instances that support locally attached non-volatile memory express (NVMe) storage.   | 
|  WriteIOPSEphemeralStorage  |  The average number of disk write I/O operations to Ephemeral NVMe storage.  This metric applies to instances that support locally attached non-volatile memory express (NVMe) storage.   | 
|  ReadIOPS  |  The average number of disk I/O operations per second but the reports read and write separately, in 1-minute intervals.  | 
|  WriteIOPS  |  The number of Aurora storage write records generated per second. This is more or less the number of log records generated by the database. These do not correspond to 8K page writes, and do not correspond to network packets sent.  | 

For more information, see [ Amazon CloudWatch metrics for Amazon Aurora](https://docs.aws.amazon.com//AmazonRDS/latest/AuroraUserGuide/Aurora.AuroraMonitoring.Metrics.html) in the *Amazon Aurora User Guide*.

If you enabled Performance Insights for Aurora, Compute Optimizer also analyzes the following metrics of your Aurora DB instances. To enable Performance Insights for Aurora, see [ Turning Performance Insights on and off for Aurora](https://docs.aws.amazon.com//AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Enabling.html) in the *Amazon Aurora User Guide*.


| Metric | Description | 
| --- | --- | 
|  DBLoad  |  The number of active sessions for the database. Typically, you want the data for the average number of active sessions. In Performance Insights, this data is queried as db.load.avg.  | 
|  os.memory.outOfMemoryKillCount  |  The number of OOM kills that happened over the last collection interval.  | 

For more information about Aurora metrics, see [ Metrics reference for Amazon Aurora](https://docs.aws.amazon.com//AmazonRDS/latest/AuroraUserGuide/metrics-reference.html) in the *Amazon Aurora User Guide*.

------
#### [ Aurora DB clusters ]

Compute Optimizer analyzes the following CloudWatch metrics of your Amazon Aurora DB clusters.


| Metric | Description | 
| --- | --- | 
|  VolumeReadIOPs  |  The number of billed read I/O operations from a cluster volume within a 5-minute interval.  | 
|  VolumeWriteIOPs  |  The number of write disk I/O operations to the cluster volume, reported at 5-minute intervals.  | 

**Note**  
Compute Optimizer analyzes these metrics to estimate the I/O cost variability over the lookback period. The Aurora DB cluster storage recommendations are based on analyzing instance costs, storage costs, and I/O costs.

------