
Two excellent Linux apps are iostat and vmstat. These provide realtime statistics of system IO and memory usage. Here’s how it works!
iostat
iostat is useful to view realtime stats of disk IO. I suggest running ‘iostat 1′ to have the command refresh each second.
$ iostat 1
Linux 3.2.0-2-amd64 (brahms) 09/12/2012 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1.83 0.16 1.88 0.45 0.00 95.67
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sdb 0.00 0.01 0.00 2220 0
sda 0.00 0.01 0.00 1751 80
sdc 3.38 87.60 34.51 15836593 6238473
sdd 1.60 21.99 28.41 3975881 5136656
sde 0.00 0.01 0.00 2220 0
sdf 8.05 158.58 224.97 28667414 40670076
avg-cpu: %user %nice %system %iowait %steal %idle
1.52 2.02 12.63 0.00 0.00 83.84
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sdb 0.00 0.00 0.00 0 0
sda 0.00 0.00 0.00 0 0
sdc 1.00 8.00 0.00 8 0
sdd 0.00 0.00 0.00 0 0
sde 0.00 0.00 0.00 0 0
sdf 0.00 0.00 0.00 0 0
avg-cpu: %user %nice %system %iowait %steal %idle
2.01 1.51 13.57 0.00 0.00 82.91
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sdb 0.00 0.00 0.00 0 0
sda 0.00 0.00 0.00 0 0
sdc 0.00 0.00 0.00 0 0
sdd 0.00 0.00 0.00 0 0
sde 0.00 0.00 0.00 0 0
sdf 0.00 0.00 0.00 0 0
^C
Another useful option with iostat is tack x to see more detail:
$ iostat -x
Linux 3.2.0-2-amd64 (brahms) 09/12/2012 _x86_64_ (4 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1.83 0.17 1.88 0.45 0.00 95.67
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sdb 0.00 0.00 0.00 0.00 0.01 0.00 8.24 0.00 0.91 0.91 0.00 0.70 0.00
sda 0.00 0.00 0.00 0.00 0.01 0.00 9.20 0.00 1.15 0.87 8.27 1.15 0.00
sdc 0.06 0.27 2.95 0.43 87.59 34.50 72.18 0.00 1.37 0.46 7.58 0.45 0.15
sdd 0.00 0.43 0.53 1.07 21.99 28.41 63.08 0.09 55.15 5.05 80.00 3.32 0.53
sde 0.00 0.00 0.00 0.00 0.01 0.00 8.24 0.00 0.95 0.95 0.00 0.70 0.00
sdf 0.67 0.56 5.21 2.85 158.55 224.93 95.26 0.15 18.75 3.06 47.44 2.12 1.71
vmstat
Another useful statistic app is vmstat. vmstat stands for virtual memory statistics. Run ‘vmstat 1′ to have this poll every second.
$ vmstat 1 procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 1780 331552 82364 5820336 0 0 68 72 7 37 2 2 96 0 1 0 1780 331544 82364 5820364 0 0 0 0 3783 2895 2 11 87 0 1 0 1780 331420 82364 5820364 0 0 0 0 5324 2854 4 12 85 0 0 0 1780 331296 82364 5820364 0 0 0 0 5355 3386 6 13 81 0 1 0 1780 331668 82364 5820364 0 0 0 0 4439 3267 6 12 81 0 1 0 1780 331536 82364 5820364 0 0 0 0 6076 3850 4 12 84 0 0 0 1780 331136 82364 5820364 0 0 0 0 6165 3146 6 12 83 0 0 0 1780 331260 82364 5820364 0 0 0 0 3909 2831 2 12 86 0 ^C
Cool!