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

I use Debian 6.0.3 x86_64 and MySQL 5.5.20-1~dotdeb.0-log from the Dotdeb repository. MySQL process started to consume a lot of "sy" CPU time serveral hours ago according to this graph. I was not able to connect to running mysqld process and had to kill it. I found nothing useful in logs. My setup seems to be quite common (I assume Dotdeb just redistributes stock MySQL versions) and I have never seen anything like this before. What is the possible root cause of this? How can I prevent this situation in the future?

share|improve this question
    
Have you looked into the leap second bug? –  sonassi Jul 9 '12 at 7:46
    
Sure. But the system was restarted on Jul 06 so the leap second bug should be irrelevant. –  Alex Jul 9 '12 at 9:04
add comment

1 Answer

up vote 5 down vote accepted

If it happens again, run strace -p <PID> -T or swap the -T with -c.

The -T option prints a time delta after each system call that lets you know how long it took. If you see particular calls like stat() and open() taking a long time you can infer one thing and if you see ones like semop() or poll() taking a long time you can infer something else. The same goes for seeing a lot of them but this can be more difficult to see which is where the next option comes in.

The -c option waits until either the program finishes or you break out with ctrl-c and then prints a summary of all the system calls and how much time was spent in each type.

With any luck, this should let you know what MySQL is doing. Then you just have to figure out what to do about it.

share|improve this answer
    
In addition to this, although it's kind of late now, MySQL has an option to log slow queries which can help in diagnosing this kind of thing. –  bahamat Jul 9 '12 at 3:56
    
@bahamat, it's a pity a comment can't be downvoted. ;-) –  poige Jul 9 '12 at 4:33
add comment

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.