1

My website is being very slow or non-responsive. A quick look at the top command shows me something like this:

PID  USER      PR  NI  VIRT  RES  SHR  S %CPU  %MEM    TIME+  COMMAND
1709 mysql     20   0  828m  432m 5584 S 382.6  5.4   7414:24 mysqld

The rest of the processes are way below those values. Obviously MySQL is having some issues. How can I check what is actually going on and why does it take so many resources?

Thanks.

3 Answers 3

2

Run show processlist in the mysql console to get a list of the currently-running queries. Look for ones which have been running for a while, to see what they're doing. Chances are there's a few queries doing monster amounts of work (usually due to poor indexes).

0
1

Apart from womble's answer (which point to optimizing your queries); for those that find 382.6% CPU usage puzzling, note that MySQL is a multithreaded server. It probably was running 4 threads full-tilt, almost monopolizing 4 cores (i'm sure it can do even more in a big enough machine). Pressing 'H' on top shows each thread separately.

0

You should also have a look at the slow log of mysql, if it is enabled.

1
  • Yes I did check that and found out that the file is over 200MB of never seen data. I have a lot of optimizing to do now.
    – 6bytes
    Nov 26, 2009 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .