Why is my EC2 instance slow, unresponsive, or inaccessible, but my CPU and memory consumption aren't high?

Last updated: 2022-08-25

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 used.

Short description

There are many possible causes of slow or unresponsive EC2 instances when CPU and memory aren't fully used, including:

  • Problems with an external service that your instance relies on.
  • Disk thrashing.
  • Network connectivity issues.

This resolution 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

  1. Open the Amazon EC2 console.
  2. In the navigation pane, choose Instances, and then select the instance.
  3. On the Storage tab, choose the Volume ID of the root device.
  4. 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

    1. Find the root EBS volume's VolumeReadOps and VolumeWriteOps metrics in Amazon CloudWatch. For more information, see Searching for available metrics.
    2. Use the CloudWatch Sum statistic to get the peak levels of VolumeReadOps and VolumeWriteOps. Then, add the two numbers together. Example:
      VolumeReadOps = 737,000
      = 199,000
      Total = 936,000
    3. To estimate how many IOPS that you need, divide the total from the previous step by the number of seconds in the measurement period.
      Measurement period = 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).

    Or, 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 volumes. For a cost comparison of gp2 and io1 volumes, see Amazon EBS pricing.

    Change how you distribute your workload

    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 Troubleshoot connecting to your instance.