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 site on AWS with the following setup:

  1. Single m1.small instance (web server)
  2. Single RDS m1.small db
  3. Joomla 1.5

Generally, the site is performant, but is fairly low-traffic - say around 50-100 visits / hour. However, at peak time, we see about double that traffic. During peak time, pretty much every day:

  1. CPU usage on the web server slowly climbs to 100%
  2. CPU usage on the RDS server climbs quite quickly to about 30%, from an average of about 15
  3. Database connections shoot up to about 140, from a normal average of about 2 or 3

The site is then occasionally unreachable, certainly according to pingdom monitoring.

Does anyone recognise this behaviour? Can you point me in the right direction to begin investigating? Of course, RDS makes it difficult to do things like slow query logging, so I've started by regularly dumping the mysql process list into a file to see if there's anything I can spot there, but it would be good to have something more concrete to investigate.

UPDATE

At least, can someone confirm that I'm definitely right in saying that the level of traffic implies the problem must be a specific type of query taking way longer than it should to execute? This would happen if a table gets locked, and many queries need to write to it, right? For this very reason, I've already changed the __session table type to InnoDB.

share|improve this question

1 Answer 1

Rather than dumping queries, you can enable slow query logging using RDS DB Parameter Groups. RDS saves slow queries in table mysql.slow_log. Here is a helpful thread.

To boost the performance, use some caching mechanism like Joomla System Cache plugin.

There might not be issue with MySQL. You also need to consider other things like images size and number of images being served from web server, performance of extensions being used with Joomla.

share|improve this answer
    
Thanks. Slow query logging is my next step - I found that thread yesterday. Having read a lot of older aws forum threads that said there was no access to the slow log, I was looking fro an alternative, so it was good to find out that slow logging is an option. I'm curious as to why you think that images being served might play a part in this - why would image requests cause a large number of db connections? –  Bobby Jack Jun 28 '12 at 9:20
    
Images will not create problems for database but it looks like a potential problem for web server as you mentioned in point 1. This is not a definite problem, it may increase web server load. Use slow query logging with care, enable it for small interval. This also increases the load of RDS as it logs queries in database. Did you consider using caching? –  mwasif Jun 28 '12 at 18:45
    
I'm already caching at the module level. Caching at the page level is not an option because most of our traffic is logged in users and content is access controlled. I have my suspicions of the culprits (a stats component that writes heavily to the db, and a sef component that makes a db call per link on a page) but want to confirm those suspicions before taking drastic action –  Bobby Jack Jun 28 '12 at 21:34

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.