The only way to diagnose a problem like this is with lots and lots of data. Familiarize yourself with vmstat
and iostat
. A tool I recently learned about in this thread is dstat
which effectively combines the two.
For problems like the one you're describing, this command would likely be useful:
$ dstat -M app -cdnygl
It will report on CPU, IO (disk and net), interrupts, swap, and load average. As a nice little bonus, it will include the name of whatever process was "most expensive" a the time the snapshot was taken. Unfortunately that particular command produces output too wide to paste here, so here's a bit more conservative version:
$ dstat -M app -cdn
--most-expensive-- ----total-cpu-usage---- -dsk/total- -net/total-
process |usr sys idl wai hiq siq| read writ| recv send
bacula-fd 0| 1 0 98 0 0 0| 426k 108k| 0 0
bash 1| 2 2 96 0 0 0| 0 20k|1460B 1804B
apache2 8| 4 2 94 0 0 0| 0 0 | 76k 15k
| 1 3 96 0 0 0| 0 0 |1132B 1034B
apache2 1| 2 2 96 0 0 0| 0 8192B| 11k 3895B
| 2 1 96 0 0 0| 0 32k|3322B 1338B
kipmi0 1| 2 2 96 0 0 0| 0 0 |1309B 1146B