iotop, get information about input / output
Follow @ggarron
Continuing with my review of performance tools, I will now introduce you with iotop which is a top-like python application that will let you know in real time the data written and read from the disk, as well as, the average speed of these input and output actions.
If you administer sites, you need to know which applications are reading and writing to the disk, so you can improve the performance of the server.
Installing it
Before installing it be sure to have:
Python ≥ 2.5 and a Linux kernel ≥ 2.6.20, to know the versions you have do this:
python -V
and for the kernel enter:
uname -r
then if everything is O.K. install it:
sudo aptitude install iotop
Or use your Distribution's package manager.
If it is not available for your distribution, download the .tar.gz from its web page
Using it
The usage is:
iotop [OPTIONS]
and the main options are:
- -o --only
- Only show processes or threads actually doing I/O, instead of showing all processes or threads. This can be dynamically toggled by pressing o.
- -d SEC, --delay=SEC
- Set the delay between iterations in seconds (1 second by default). Accepts non-integer values such as 1.1 seconds. -b, --batch
- Turn on non-interactive mode. Useful for logging I/O usage over time.
I like to use it with the -o switch, to see only the processes that are actually writing or reading the disk, combining it with -b switch, gives also a nice output to log over the time.
So using this:
iotop -o -b
Gives something like this output:
PID USER DISK READ DISK WRITE SWAPIN IO COMMAND 2894 ggarron 0 B/s 19.26 K/s 0.00 % 0.00 % firefox Total DISK READ: 0 B/s | Total DISK WRITE: 211.87 K/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND 571 root 0 B/s 211.87 K/s 0.00 % 2.01 % [kjournald] Total DISK READ: 0 B/s | Total DISK WRITE: 0 B/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND Total DISK READ: 0 B/s | Total DISK WRITE: 0 B/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND Total DISK READ: 0 B/s | Total DISK WRITE: 0 B/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND Total DISK READ: 0 B/s | Total DISK WRITE: 0 B/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND Total DISK READ: 0 B/s | Total DISK WRITE: 0 B/s PID USER DISK READ DISK WRITE SWAPIN IO COMMAND 571 root 0 B/s 0 B/s 0.00 % 0.07 % [kjournald]
Here you also have a screenshot of the interactive mode, taken from its official site:
