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.
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.
Check each possibility...
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.
Where is the utilization high? What do
iotop tell you? Are you swapping?
You run commands from the terminal or ssh
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.