Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm running a Wordpress installation on an Amazon Ec2 micro instance(linux ami). Using the default configuration Apache kept using up all the memory and shutting down mysql rendering wordpress non-functional.

I adjusted my apache configuration based on information from Making WordPress Stable on EC2-Micro and changed the mysql configuration to the sample configuration for small servers.Those adjustments seem to have dealt with the memory issue.

However, I noticed that with mysqld service turned off cpu usage hovers around 0 -5% with 10% being a peak but as soon as I start mysql cpu time stays between 40 -60%. Is this normal? and what can I do to remedy it if it is not. Its just a test server so there's virtually no traffic to the site.I also checked with mysqladmin processlist and stat commands,there was no indication of any 'evil' queries.

share|improve this question
1  
What is your %st in top? Is that relevant? –  David Csonka Jul 27 '12 at 14:55
    
@DavidCsonka i checked the %st and it also hovers around 50% frequently,but if i understand correctly this is mainly reinforcing the fact that mysqld is asking for a lot of cputime and hence my enitre vm is at many points not getting all the cputime it requests –  Joseph Amegatcher Jul 30 '12 at 14:02
    
Exactly as you said @JosephAmegatcher. WordPress makes a lot of joins in each run, so it hits the db quite often with CPU intensive tasks; and the micro instance just doesn't like it and your instance gets CPU constrained. Try switching your instance to a medium one and see the difference immediately. –  Javier Constanzo Jul 30 '12 at 14:50
    
@JavierConstanzo Can't switch to a medium instance yet because i'm relying on amazon's free tier.. but does that mean that this is the expected behavior of mysql when Wordpress is run on an ec2 micro instance?Especially since there isn't even yet traffic to the blog.. –  Joseph Amegatcher Aug 1 '12 at 12:19
    
@JosephAmegatcher in my experience, I would only host plain html in a micro instance running a web server. YMMV though. –  Javier Constanzo Aug 7 '12 at 4:20

1 Answer 1

up vote 4 down vote accepted

The keyword here is micro instance. Micros are a great way to handle low-demand and intermittent loads, as long as you are comfortable with the latency. What is happening on startup is that you are consuming your cpu "spike" buffer and then the VM is getting clamped, resulting in high steal-time. This is how micros are designed to operate, not a problem with WP or MySQL or even with your AWS setup.

This page in the AWS docs talks about micros and how they behave under load. It sounds like your workload (test server, no users) is a good fit for using a micro, just be aware of the cpu clamping that will occur when you restart a service.

I've used micro instances for doing work on Plone, which consumes a huge amount of cpu on startup. At first I was quite surprised, but it was fine once I got used to it. EDIT- was suggesting moving up to a small but saw OP's comment about using free-tier. Free tier usage is what it is, a nice introduction to AWS but not a production setup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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