minitorovaniio
Toto je starší verze dokumentu!
Obsah
Monitorovani IO
- kolik CPU/RAM zere jaky proces se zjisti snadno, napriklad vypisem iotop
- monitorovani IO je zlozitejsi a dost casto zpomaluje system nejvic
- existuji programy:
- iotop
- atop
- pidstat
- dstat (–topio, –topbio)
- vmstat (-d)
- iostat
- iozone
- sar
UseCase1 (processes read/write old kernel method)
Here’s how you use it. First, get it:
wget http://aspersa.googlecode.com/svn/trunk/iodump
Then turn on kernel messages about I/O:
echo 1 > /proc/sys/vm/block_dump
This makes the kernel start writing messages about every I/O operation that takes place. Now all you have to do is get those messages and feed them into my script:
while true; do sleep 1; dmesg -c; done | perl iodump
Wait a little while, then cancel the script. The results should look something like the following:
root@kanga:~# while true; do sleep 1; dmesg -c; done | perl iodump ^C# Caught SIGINT. TASK PID TOTAL READ WRITE DIRTY DEVICES firefox 4450 4538 251 4287 0 sda4, sda3 kjournald 2100 551 0 551 0 sda4 firefox 28452 185 185 0 0 sda4 kjournald 782 59 0 59 0 sda3 pdflush 31 30 0 30 0 sda4, sda3 syslogd 2485 2 0 2 0 sda3 firefox 28414 2 2 0 0 sda4, sda3 firefox 28413 1 1 0 0 sda4 firefox 28410 1 1 0 0 sda4 firefox 28307 1 1 0 0 sda4 firefox 28451 1 1 0 0 sda4
I deliberately generated a bunch of I/O by deleting my Firefox history and cache.
Do dmseq se zapisuje neco jako….
firefox(4450): WRITE block 25058328 on sda4 firefox(4450): WRITE block 25058336 on sda4 firefox(4450): WRITE block 25059104 on sda4
UseCase2 (single process read/write)
A quick way is to look at the /proc/[PID]/io file.
Example:
$ cat /proc/1944/io read_bytes: 17961091072 write_bytes: 8192000 cancelled_write_bytes: 32768
UseCase3 (high IO waiting)
wa -- iowait (Amount of time the CPU has been waiting for I/O to complete)
- procesy ve stavu D
PROCESS STATE CODES
D uninterruptible sleep (usually IO)
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct ("zombie") process, terminated but not reaped by its parent.
- vypis procesu ve stavu D
for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "----"; sleep 5; done
minitorovaniio.1388342063.txt.gz · Poslední úprava: (upraveno mimo DokuWiki)
