Observing Linux performance with dstat


I mentioned a few posts back that I was playing with a bunch of Linux utilities. One of these utilities is dstat, which allows you to view a number of system statistics (disk utilization, network utilization, page activity, etc.) from the command line:

$ dstat

----total-cpu-usage---- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai hiq siq| read writ| recv send| in out | int csw
0 0 100 0 0 0|1591B 134k| 0 0 | 0 0.6B| 1 4
1 7 90 0 1 1| 0 0 |2939k 69k| 0 0 |2784 3190
2 6 88 0 2 2| 0 0 |2882k 68k| 0 0 |2738 3079
0 9 90 0 0 1| 0 552k|2724k 64k| 0 0 |2591 2859
1 10 71 13 2 4| 0 22M|2782k 67k| 0 0 |2693 2773
0 4 92 0 2 2| 0 0 |2646k 63k| 0 0 |2487 2781
0 4 95 0 0 1| 0 0 |1712k 42k| 0 0 |1696 2069
1 7 91 0 0 1| 0 0 |2593k 63k| 0 0 |2489 2781
2 6 89 0 2 1| 0 2896k|2695k 64k| 0 0 |2555 2918
1 6 65 23 2 3| 0 21M|2760k 65k| 0 0 |2688 2942

The default output contains a number of useful statistics, but additional stats can be displayed if you pass a few options to dstat:

$ dstat -tcdgimnsy

-----time----- ----total-cpu-usage---- -dsk/total- ---paging-- -interrupts ------memory-usage----- -net/total- -swp/total- ---system--
date/time |usr sys idl wai hiq siq| read writ| in out | 17 18 | used buff cach free| recv send| used free| int csw
08-03 09:43:42| 0 0 100 0 0 0|1607B 134k| 0 0.6B| 1 1 | 19M 12M 104M 116M| 0 0 | 92k 729M| 1 5
08-03 09:43:43| 0 0 100 0 0 0| 0 0 | 0 0 | 0 5 | 19M 12M 104M 116M| 198B 580B| 92k 729M| 5 14
08-03 09:43:44| 0 1 99 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 8
08-03 09:43:45| 0 0 100 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 8
08-03 09:43:46| 0 0 100 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 14
08-03 09:43:47| 0 1 99 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 7
08-03 09:43:48| 0 0 100 0 0 0| 0 240k| 0 0 | 2 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 6 13
08-03 09:43:49| 0 0 100 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 8
08-03 09:43:50| 0 0 100 0 0 0| 0 0 | 0 0 | 0 4 | 19M 12M 104M 116M| 132B 580B| 92k 729M| 4 8

The output above will overflow a standard 80 character wide display, so you may need to adjust the size of your terminal window to see everything. Dstat is an amazing utility, and yet another tool I plan to add to my performance analysis toolkit.

This article was posted by Matty on 2009-03-08 09:58:00 -0400 -0400