Mech
Mech

Reputation: 79

AWS site down issue because cpu utilization reach 100%

I am using an Amazon EC2 instance with instance type m3.medium and an Amazon RDS database instance.

In my working hours the website goes down because CPU utilization reaches 100%, and at night (not working hours) the CPU utilization is 60%.

So please give me right solution for this site down issue. I am not sure why I am experiencing this problem.

Once I had set a cron job for every minutes, but I was removed it because of slow down issue, but still I have site down issue.

CloudWatch chart

When i try to use "top" command, i had shows below images for cpu usage, in which httpd command consume more cpu usage, so any suggestion for settings to reduce cpu usage with httpd command Without website use by any user below two images: http://screencast.com/t/1jV98WqhCLvV http://screencast.com/t/PbXF5EYI After website access simultaneously 5 users http://screencast.com/t/QZgZsiNgdCUl

Upvotes: 1

Views: 3193

Answers (2)

siomes
siomes

Reputation: 181

If the cpu utilization reach 100% bacause of the number of visitors your site have, you must consider to change the instance type, Auto Scaling or AWS CloudFront in order to cache as many http requests as posible (static and dynamic content).

If visitors are not the problem and there are other scheduled tasks on the EC2 isntance, I strongly recomend to decouple these workload via AWS SQS & AWS Elasticbeanstalk - Worker type

Upvotes: 0

Ali
Ali

Reputation: 1105

If you are CPU Utilization is reaching 100% you have two options.

  1. Increase your EC2 Instance Type to large.
  2. Use AutoScaling to launch one more EC2 Instance of same Instance Type.

Looks like you need some scheduled actions as you donot need 100% CPU Utilization during non-working hours.

The best possible option is to use AWS AutoScaling with Scheduled actions. http://docs.aws.amazon.com/autoscaling/latest/userguide/schedule_time.html

AWS AutoScaling can launch new EC2 instances based on your CPU Utilization (or other metrics like Network Load, Disk read/write etc). This way you can always keep your site alive.

Using the AutoScaling scheduled actions you can specify metrics such that you stop your autoscaled instances during non-working hours and autoscale instances during working hours according to CPU Utilization(or other metrics).

You can even stop your severs if you donot need them at some point of time.

If you are not familiar with AWS AutoScaling you can follow the Documentation which is very precise and easy. http://docs.aws.amazon.com/autoscaling/latest/userguide/GettingStartedTutorial.html

Upvotes: 2

Related Questions