Measure disk I/O in Ubuntu
Q. I think I'm having disk I/O problems on my system. How do I check what it is or measure it?
A. First, you'll have to install some applications/tools:
apt-get install sysstat
apt-get install iotop
iotop command, much like top, will give you the real-time overview of your Read/Write requests. It's fun to look at, but we find useless for measuring I/O.
If you want some data that gives you an average, you should probably run something like this:
iostat -dkx
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await svctm %util
sda 0.04 321.99 1.12 16.63 68.11 1354.49 160.26 5.04 284.09 4.05 7.19
Legend:
- r/s and w/s: number of read and write requests issued per second to the device
- rsec/s and wsec/s – number of sectors read/written per second
- rkB/s and wkB/s – number of kilobytes read/written per second
- avgrq-sz – average number of sectors per request (for both reads and writes). ie (rsec + wsec) / (r + w)
- avgqu-sz – average queue length in the monitoring interval
- await – average time that each IO Request took to complete. This includes the time that the request was waiting in the queue and the time that the request took to be serviced by the device
- svctm – average time each IO request took to complete during the monitoring interval
- %util: This number depicts the percentage of time that the device spent in servicing requests.
If the %util is too high (above 75-80%), you have a bottleneck.
apt-get install iotop