How do I troubleshoot slow connections to a website hosted on my EC2 instance?

3 minute read
0

I run a public website on my Amazon Elastic Compute Cloud (Amazon EC2) instance, but connections to my website are slow.

Short description

Over-utilization of your instance's resources might cause slow connections to a website hosted on the instance. To make sure that you aren't over-utilizing your instance's resources, check the following conditions:

  • Check the instance's system log for exhausted memory or disk full errors.
  • Make sure that the instance's system log indicates that the web service started correctly and is running.
  • Make sure that the instance is within CPU utilization limits.
  • Make sure that the Amazon Elastic Block Store (Amazon EBS) volume that's attached to the instance didn't reach the IOPS or throughput limits.

Resolution

Check the instance's system log for exhausted memory or disk full errors

Note: If you use Docker containers, cgroups, and so on, you might see out of memory or other insufficient memory errors. These errors might be intentional because of your configuration.

Make sure that the instance's system log indicates that the web service started correctly and is running

Reboot the instance and check to see your web service started normally. Or, look for any errors that might prevent the restart.

Make sure that the instance is within CPU utilization limits

Check the NetworkIn and NetworkOut instance metrics in the CloudWatch metrics table.

For T2 or T3 instances, check the CPU credit metrics in the CloudWatch metrics table to determine if the CPU credits are at or near zero. If the CPU credits are at zero, the CPUUtilization metric shows a saturation plateau at the baseline performance for the instance. The baseline performance might be 20%, 40%, or so on, depending on the instance type.

For information on resolving this issue, see How do I troubleshoot an EC2 Linux instance that fails a status check due to over-utilization of resources?

Make sure that the Amazon EBS volume attached to the instance hasn't hit the IOPS or throughput limits

Verify that your Amazon EBS volume isn't hitting IOPS limits. If your volume reaches its IOPS limit, then latency increases, and this might negatively impact your website. For information on how to optimize volume performance, see How do I optimize the performance of my Amazon EBS Provisioned IOPS volumes?

If you use a GP2 volume, then check that your volume hasn't exhausted the burst credits.

Related information

Why can't I connect to a website that is hosted on my EC2 instance?

AWS OFFICIAL
AWS OFFICIALUpdated 25 days ago