-1

Yesterday my Amazon Web Service instance was running perfectly but today morning it became slow. I searched on internet about it and found that I can reboot my Amazon Web Service instance to increase performance so I rebooted my instance.

But from that time it became even more slower and sometime not even able to access it, If I restart my mysqld it starts working but again even a simple query takes lot of time. I am using Amazon Web Service free Tier EC2. Is there something I missed after rebooting?

4
  • 2
    You probably have run out of CPU Credit Nov 5, 2017 at 16:03
  • Actually i have checked my CPU credits, Instance is using only around 20% of CPU. @Sathya Nov 5, 2017 at 16:53
  • CPU credits is different from CPU usage. Read this. If you want help you're going to have to share information such as instance type, top screenshot, and a screenshot of your CloudWatch dashboard showing CPU usage and CPU credit balance, what the server does, etc. Another thing to do is stop then start the server, which moves you to new hardware - a restart doesn't. From memory a stop / start cycle gives you a new CPU credit balance, but you have to pay for a new hour.
    – Tim
    Nov 5, 2017 at 18:28
  • if the website already configured using wordpress, you will get surely this problem when you don't have an elastic IP address for you instance. Because by default, the address IP is still changing when rebooting you instance EC2. The solution is to change the old DNS in the wordpress with the new DNS (surely an IP adress)
    – kaissun
    Jun 9, 2020 at 17:08

1 Answer 1

2

There are a number of factors that can cause an EC2 instance (or any system) to appear to run slowly.

  1. CPU Usage. The higher the CPU usage the longer to process new threads and processes.

  2. Free Memory. Your system needs free memory to process threads, create new processes, etc. How much free memory do you have?

  3. Free Disk Space. Operating systems tend to thrash when the file systems on system drives run low on free disk space. How much free disk space do you have?

  4. Network Bandwidth. What is the average bytes in / out for your instance?

When I see a slow EC2 instance, I temporarily bump it up an instance size or two. Then I remeasure. If I see a good increase in performance, then I am pretty sure that the instance is overloaded. Next I try to determine which factor of CPU, Memory, etc. is the culprit.

Amazon has CloudWatch which can provide you with monitoring for everything except for free disk space (you can add an agent to your instance for this metric). This will also help me quickly see what is happening with my instances.

In general I find that a web server and MySQL on a T2.nano or T2.micro is not that good unless there is very little network traffic.

If your average CPU utilization is 20%, then a t2.micro would be too small. A t2.small has enough CPU credits so that the CPU utilization can be 20%.

For example, a t2.small instance receives credits continuously at a rate of 12 CPU Credits per hour. This capability provides baseline performance equivalent to 20% of a CPU core. If at any moment the instance does not need the credits it receives, it stores them in its CPU Credit balance for up to 24 hours. If and when your t2.small needs to burst to more than 20% of a core, it draws from its CPU Credit balance to handle this surge seamlessly. Over time, if you find your workload needs more CPU Credits than you have, or your instance does not maintain a positive CPU Credit balance, we recommend either a larger T2 size, such as the t2.medium, or a Fixed Performance Instance type.

Burstable Performance Instances

2
  • I run a t2.nano as a web server for Wordpress, including MySQL. Because things are so heavily cached on the CDN the average CPU usage is around 2%. It works very well.
    – Tim
    Nov 5, 2017 at 18:30
  • @Tim. Good example of the benefits of CDNs such as CloudFront. Nov 5, 2017 at 18:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.