My EC2 instance is slow, unresponsive, or inaccessible, but my CPU and memory consumption aren't high
Last updated: 2019-08-23
I'm having trouble connecting to an Amazon Elastic Compute Cloud (Amazon EC2) instance that has an Amazon Elastic Block Store (Amazon EBS) General Purpose SSD (gp2) root volume. The connection is slow or times out, even though CPU and memory aren't fully utilized.
There are many possible causes of this problem, including problems with an external service that your instance relies on, disk thrashing, or network connectivity issues. This article discusses one common cause: depleted I/O burst credits on the gp2 root volume. (In most Regions, gp2 is the default storage drive for root volumes. For more information, see Amazon EBS Volume Types.)
Check I/O burst credit balance
- Open the Amazon EC2 console.
- In the navigation pane, choose Instances, and then select the instance.
- On the Description tab, choose the Root device link, and then choose the EBS ID link.
- Choose the Monitoring tab for the EBS volume, and then find the Burst Balance metric. A burst balance of 0% means that all the burst credits are used and the volume can't burst above its baseline performance level. Use one of the following methods to resolve this problem.
Estimate IOPS requirements, and then modify the volume to support the load
- Find the root EBS volume's VolumeReadOps and VolumeWriteOps metrics in Amazon CloudWatch. For more information, see Searching for Available Metrics.
- Use the CloudWatch Sum statistic to get the peak levels of VolumeReadOps and VolumeWriteOps. Then, add the two numbers together. Example:
VolumeReadOps = 737,000
VolumeWriteOps = 199,000
Total = 936,000
- To estimate how many IOPS you need, divide the total from the previous step by the number of seconds in the measurement interval. Example:
Measurement interval = 5 minutes (300 seconds)
936,000 / 300 = 3,120 IOPS
Baseline performance for gp2 volumes scales linearly at 3 IOPS per GiB of volume size. This means that a volume with 3,120 IOPS must be scaled up to 1,040 GiB to improve performance (3,120 / 3 = 1,040).
Alternatively, change your volume from gp2 to Provisioned IOPS SSD (io1). With io1 volumes, you can specify how many IOPS you need without increasing the volume size. For more information about when to use io1 volumes, see Provisioned IOPS SSD (io1) Volumes. For a cost comparison of gp2 and io1 volumes, see Amazon EBS Pricing.
Change how your workload is distributed
When you have multiple applications on an EC2 instance, those applications compete for the root EBS volume’s IOPS. As your workload grows over time, the IOPS demand increases. To improve performance on your instance, consider using additional non-root EBS volumes for your applications. Also, consider using the root volume for the operating system only.
If you still have trouble connecting to your EC2 instance after modifying the volume size and the workload distribution, see Troubleshooting Connecting to Your Instance.