Skip to content

How do I troubleshoot slow connections to a website that's hosted on my Amazon 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

High usage of your EC2 instance's resources might cause slow connections to a website that's hosted on the instance. To make sure that you don't overuse the instance's resources, take the following actions.

Resolution

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

Check the instance's system logs for out-of-memory error messages. Also, check the logs for "oom-killer", "failure to fork", or other insufficient memory errors. To troubleshoot these issues, see How do I tune the Apache web server's memory allocation to prevent out of memory errors in my EC2 Linux instance?

Note: If you use Docker containers or cgroups, then you might experience memory issues because of how you configured your settings. Make sure that you correctly configure memory in your containers.

Also, check a screenshot of the instance for errors. To troubleshoot issues in Windows instances, see Common screenshots to troubleshoot unreachable Windows instances. To troubleshoot issues in Linux instances, see Why is my Amazon EC2 Linux instance unresponsive?

Check for web service issues

Reboot the instance, and then verify that your web service started normally.

If there's an issue that prevents restart, then check the system logs and web server access error logs at /var/log for errors.

Make sure that the instance CPU usage isn't too high

To identify high CPU usage, check the NetworkIn and NetworkOut instance metrics in Amazon CloudWatch. For T2 or T3 instances, also check whether the CPU credit metrics are at or near zero.

Then, troubleshoot the high CPU usage for your Linux or Windows instances.

Make sure that the instance's Amazon EBS volume didn't exceed the IOPS or throughput quotas

Amazon Elastic Block Store (Amazon EBS) volumes have maximum quotas for input/output operations per second (IOPS) and throughput. If your volume exceeds these quotas, then latency increases and affects your website's performance.

For information about 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 the BurstBalance for your volume to make sure that the volume still has burst credits. For consistent baseline performance without burst quotas, it's a best practice to migrate from GP2 to GP3.

Related information

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

AWS OFFICIALUpdated 2 months ago