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

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

ResolutionCheck I/O burst credit balanceOpen the Amazon EC2 console.In the navigation pane, choose Instances, and then select the instance.On the Storage tab, choose the Volume ID of the root device.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 loadFind 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,000Total = 936,000To estimate how many IOPS that you need, divide the total from the previous step by the number of seconds in the measurement period.Example:Measurement period = 5 minutes (300 seconds)936,000 / 300 = 3,120 IOPSBaseline 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 workloadWhen 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.

Related informationI/O characteristics and monitoringHow do I optimize the performance of my Amazon EBS Provisioned IOPS volumes?How are charges for Amazon EBS volumes calculated on my bill?