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 have a LAMP server running with a large database serving a large number of requests. If things start slowing down, how do I tell if the bottleneck is the database, the processor, disk I/O, or bandwidth, or something else? How do I do this on a live server, ie, I don't want to take things down for benchmarking.

share|improve this question

closed as not a real question by MDMarra, Chris S, EEAA, Shane Madden, kce Jan 16 '12 at 1:49

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

    
You're not giving us much to go on here... –  gWaldo Jan 16 '12 at 0:43
    
How big is a "large database"? Is MySQL serving a lot of req's, or is it Apache, or are there a lot of PHP hits? Provide the req/s for all of those. –  gWaldo Jan 16 '12 at 0:47
    
The OP don't want us to answer WHERE is the bottleneck but only HOW he can investigate where it is so I don't think the question lacks info :) - maybe overly broad –  laurent Jan 16 '12 at 1:56
    
Sorry, but I am admittedly learning here, thus my question. I have a very powerful system, with a very large mysql database, but my website is going very slow. How would I quickly narrow it down to either disk I/O or processor/database issue? Let's say it's not the disk I/O, but cpu usage is high, being used by mysql. Would the only way to speed things up there be to buy a faster system? Thanks! –  cat pants Jan 16 '12 at 9:23

3 Answers 3

up vote 3 down vote accepted

Check each possibility... top or htop for processor / RAM use and see what process is eating more resources, slow queries for the database, network monitoring for bandwidth and so on.

share|improve this answer
    
Thanks! This is exactly what I needed here. –  cat pants Apr 26 '12 at 19:29

Where is the utilization high? What do htop and iotop tell you? Are you swapping?

You run commands from the terminal or ssh

share|improve this answer

Unfortunately on MySQL there's no way to query the list of most consuming queries grouped by queries without the variables.

It's always good to run the long running queries report but it might not be the most consuming one (a quick running query, called the most could reduce your work load by a LOT if you reduce it's memory and cpu consumption by half somehow)

On the DB, your performance issues could be by design (poorly design model), server performance (try putting your indexes and your data file on different partitions), or simply query optimization.

Try to identify which part of your site is particularly slow and how much it's called. Try crossing these 2 informations to identify eventual bottleneck.

It's a pain on MySQL to identify specific poor performing queries.

share|improve this answer
    
True but HTOP or TOP will show the MySQL CPU use and from this you can see if MySQL can be the responsible for bottleneck running a lot of queries as it will use a lot of CPU. After that, finding where in MySQL is the problem is another round! :) and as you said, not always easy! –  laurent Jan 16 '12 at 1:47

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