How to Tell When PHP or Mysql Processes are Killing Performa
I have Drupal site that all of a sudden slowed to an unbearable trickle. Pages were taking literally minutes to load.
I checked the memory but nothing seemed out of the ordinary:
total used free shared buffers cached
Mem: 630 569 60 0 89 304
-/+ buffers/cache: 175 454
Swap: 255 0 255
I checked the memory (which I didn't save) but there were about 10 apache processes averaging about 4% MEM and 6% CPU as well as one mysqld averaging about 7% MEM and 5% CPU.
I tried pruning apache and mysql but nothing. The various logs in /var/log didn't indicate anything. After a couple of hours of playing around I discoverd that the sessions table in the database was about 10 times the size it had been the day before. The culprint was a 'single signon' module that was writing a couple hundred rows to the sessions table for every site visitor. Once I removed the module things went back to normal immediately. Mini-crisis averted.
My question is, 'Is there a way to tell that a PHP or Mysql process is responsible for slowing things down so drastically?' Or was there a better way to troubleshoot this?
2 Replies
MySQL logsmysqlbinlog
I'm turning on the slow mysql log so if I have similar problem in the future I will have some history there.