Reputation: 851
I have some problem about my EC2 instance.
Background: I'm new to AWS and just deployed my first Wordpress test site onto a T2.Large instance. I know we need Elastic Beanstalk to make it scalable, however, we just want to make this test site as a development environment. We have 6 people using Wordpress at the same time and I can make sure we don't have any error with Wordpress.
My problem: This EC2 instance will gradually become slower every day. The response time will increase from 200ms to 5.6s after working for one day. If I restart my HTTPd and MySql, then everything solved. So I have three questions:
Is this normal for a rough EC2 environment?
Should I make some configuration to restart my HTTPd and MySql every day?
If I change to an Elastic Beanstalk environment, will this problem disappear?
Thanks for answering my questions!
Upvotes: 1
Views: 4523
Reputation: 7549
I'm far from being an AWS expert, but it could depend on what sort of load you're running on your EC2 instance. You're running on a T2, which is a burstable instance and runs on credits.
Burstable Performance Instances provide a baseline level of CPU performance with the ability to burst above the baseline. T2 instances are for workloads that don’t use the full CPU often or consistently, but occasionally need to burst.
T2 instances’ baseline performance and ability to burst are governed by CPU Credits.
From the AWS documentation (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-instances.html#t2-instances-monitoring-cpu-credits):
CPU Credit provides the performance of a full CPU core for one minute. Traditional Amazon EC2 instance types provide fixed performance, while T2 instances provide a baseline level of CPU performance with the ability to burst above that baseline level. The baseline performance and ability to burst are governed by CPU credits.
What is a CPU credit?
One CPU credit is equal to one vCPU running at 100% utilization for one minute. Other combinations of vCPUs, utilization, and time are also equal to one CPU credit; for example, one vCPU running at 50% utilization for two minutes or two vCPUs running at 25% utilization for two minutes.
What happens if I use all of my credits?
If your instance uses all of its CPU credit balance, performance remains at the baseline performance level. If your instance is running low on credits, your instance’s CPU credit consumption (and therefore CPU performance) is gradually lowered to the base performance level over a 15-minute interval, so you will not experience a sharp performance drop-off when your CPU credits are depleted. If your instance consistently uses all of its CPU credit balance, we recommend a larger T2 size or a fixed performance instance type such as M3 or C3.
It's possible that you're running low on credits, causing your machine to slow down.
It might be a good idea to use CloudWatch to monitor the credits of the EC2 instance and see if anything is going on (CPUCreditBalance
and CPUCreditUsage
being the relevant metrics).
If you notice that the issue is being caused by low credits, you could try and switching to a different instance type (i.e. an M4 or C4).
Upvotes: 6