Add -lhHpw options to "zpool iostat" for avg latency, histograms, & queues

Update the zfs module to collect statistics on average latencies, queue sizes,
and keep an internal histogram of all IO latencies.  Along with this, update
"zpool iostat" with some new options to print out the stats:

-l: Include average IO latencies stats:

 total_wait     disk_wait    syncq_wait    asyncq_wait  scrub
 read  write   read  write   read  write   read  write   wait
-----  -----  -----  -----  -----  -----  -----  -----  -----
    -   41ms      -    2ms      -   46ms      -    4ms      -
    -    5ms      -    1ms      -    1us      -    4ms      -
    -    5ms      -    1ms      -    1us      -    4ms      -
    -      -      -      -      -      -      -      -      -
    -   49ms      -    2ms      -   47ms      -      -      -
    -      -      -      -      -      -      -      -      -
    -    2ms      -    1ms      -      -      -    1ms      -
-----  -----  -----  -----  -----  -----  -----  -----  -----
  1ms    1ms    1ms  413us   16us   25us      -    5ms      -
  1ms    1ms    1ms  413us   16us   25us      -    5ms      -
  2ms    1ms    2ms  412us   26us   25us      -    5ms      -
    -    1ms      -  413us      -   25us      -    5ms      -
    -    1ms      -  460us      -   29us      -    5ms      -
196us    1ms  196us  370us    7us   23us      -    5ms      -
-----  -----  -----  -----  -----  -----  -----  -----  -----

-w: Print out latency histograms:

sdb           total           disk         sync_queue      async_queue
latency    read   write    read   write    read   write    read   write   scrub
-------  ------  ------  ------  ------  ------  ------  ------  ------  ------
1ns           0       0       0       0       0       0       0       0       0
...
33us          0       0       0       0       0       0       0       0       0
66us          0       0     107    2486       2     788      12      12       0
131us         2     797     359    4499      10     558     184     184       6
262us        22     801     264    1563      10     286     287     287      24
524us        87     575      71   52086      15    1063     136     136      92
1ms         152    1190       5   41292       4    1693     252     252     141
2ms         245    2018       0   50007       0    2322     371     371     220
4ms         189    7455      22  162957       0    3912    6726    6726     199
8ms         108    9461       0  102320       0    5775    2526    2526      86
17ms         23   11287       0   37142       0    8043    1813    1813      19
34ms          0   14725       0   24015       0   11732    3071    3071       0
67ms          0   23597       0    7914       0   18113    5025    5025       0
134ms         0   33798       0     254       0   25755    7326    7326       0
268ms         0   51780       0      12       0   41593   10002   10002       0
537ms         0   77808       0       0       0   64255   13120   13120       0
1s            0  105281       0       0       0   83805   20841   20841       0
2s            0   88248       0       0       0   73772   14006   14006       0
4s            0   47266       0       0       0   29783   17176   17176       0
9s            0   10460       0       0       0    4130    6295    6295       0
17s           0       0       0       0       0       0       0       0       0
34s           0       0       0       0       0       0       0       0       0
69s           0       0       0       0       0       0       0       0       0
137s          0       0       0       0       0       0       0       0       0
-------------------------------------------------------------------------------

-h: Help

-H: Scripted mode. Do not display headers, and separate fields by a single
    tab instead of arbitrary space.

-q: Include current number of entries in sync & async read/write queues,
    and scrub queue:

 syncq_read    syncq_write   asyncq_read  asyncq_write   scrubq_read
 pend  activ   pend  activ   pend  activ   pend  activ   pend  activ
-----  -----  -----  -----  -----  -----  -----  -----  -----  -----
    0      0      0      0     78     29      0      0      0      0
    0      0      0      0     78     29      0      0      0      0
    0      0      0      0      0      0      0      0      0      0
    -      -      -      -      -      -      -      -      -      -
    0      0      0      0      0      0      0      0      0      0
    -      -      -      -      -      -      -      -      -      -
    0      0      0      0      0      0      0      0      0      0
-----  -----  -----  -----  -----  -----  -----  -----  -----  -----
    0      0    227    394      0     19      0      0      0      0
    0      0    227    394      0     19      0      0      0      0
    0      0    108     98      0     19      0      0      0      0
    0      0     19     98      0      0      0      0      0      0
    0      0     78     98      0      0      0      0      0      0
    0      0     19     88      0      0      0      0      0      0
-----  -----  -----  -----  -----  -----  -----  -----  -----  -----

-p: Display numbers in parseable (exact) values.

Also, update iostat syntax to allow the user to specify specific vdevs
to show statistics for.  The three options for choosing pools/vdevs are:

Display a list of pools:
    zpool iostat ... [pool ...]

Display a list of vdevs from a specific pool:
    zpool iostat ... [pool vdev ...]

Display a list of vdevs from any pools:
    zpool iostat ... [vdev ...]

Lastly, allow zpool command "interval" value to be floating point:
    zpool iostat -v 0.5

Signed-off-by: Tony Hutter <hutter2@llnl.gov
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4433
This commit is contained in:
Tony Hutter
2016-02-29 10:05:23 -08:00
committed by Brian Behlendorf
parent 20c901dc7a
commit 193a37cb24
29 changed files with 2077 additions and 181 deletions
+206 -3
View File
@@ -95,7 +95,9 @@ zpool \- configures ZFS storage pools
.LP
.nf
\fBzpool iostat\fR [\fB-T\fR d | u ] [\fB-gLPvy\fR] [\fIpool\fR] ... [\fIinterval\fR[\fIcount\fR]]
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPvy\fR] [\fB-G\fR|[\fB-lq\fR]]
[[\fIpool\fR ...]|[\fIpool vdev\fR ...]|[\fIvdev\fR ...]] [\fIinterval\fR[\fIcount\fR]]\fR
.fi
.LP
@@ -1677,11 +1679,22 @@ Scan using the default search path, the libblkid cache will not be consulted. A
.ne 2
.mk
.na
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-gLPvy\fR] [\fIpool\fR] ... [\fIinterval\fR[\fIcount\fR]]\fR
\fB\fBzpool iostat\fR [\fB-T\fR \fBd\fR | \fBu\fR] [\fB-ghHLpPvy\fR] [\fB-w\fR|[\fB-lq\fR]] [[\fIpool\fR ...]|[\fIpool vdev\fR ...]|[\fIvdev\fR ...]] [\fIinterval\fR[\fIcount\fR]]\fR
.ad
.sp .6
.RS 4n
Displays \fBI/O\fR statistics for the given pools. When given an interval, the statistics are printed every \fIinterval\fR seconds until \fBCtrl-C\fR is pressed. If no \fIpools\fR are specified, statistics for every pool in the system is shown. If \fIcount\fR is specified, the command exits after \fIcount\fR reports are printed.
Displays \fBI/O\fR statistics for the given \fIpool\fRs/\fIvdev\fRs. You can
pass in a list of \fIpool\fRs, a \fIpool\fR and list of \fIvdev\fRs in that
\fIpool\fR, or a list of any \fIvdev\fRs from any \fIpool\fR. If no items are
specified, statistics for every pool in the system are shown. When given an
interval, the statistics are printed every \fIinterval\fR seconds until
\fBCtrl-C\fR is pressed. If \fIcount\fR is specified, the command exits after
\fIcount\fR reports are printed. The first report printed is always the
statistics since boot regardless of whether \fIinterval\fR and \fIcount\fR
are passed. However, this behavior can be suppressed with the -y flag. Also
note that the units of 'K', 'M', 'G'... that are printed in the report are in
base 1024. To get the raw values, use the \fB-p\fR flag.
.sp
.ne 2
.mk
@@ -1706,6 +1719,17 @@ Specify \fBu\fR for a printed representation of the internal representation of t
Display vdev GUIDs instead of the normal device names. These GUIDs can be used in place of device names for the zpool detach/offline/remove/replace commands.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-H\fR\fR
.ad
.RS 12n
.rt
Scripted mode. Do not display headers, and separate fields by a single tab instead of arbitrary space.
.RE
.sp
.ne 2
.mk
@@ -1717,6 +1741,17 @@ Display vdev GUIDs instead of the normal device names. These GUIDs can be used i
Display real paths for vdevs resolving all symbolic links. This can be used to look up the current block device name regardless of the /dev/disk/ path used to open it.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-p\fR\fR
.ad
.RS 12n
.rt
Display numbers in parseable (exact) values. Time values are in nanoseconds.
.RE
.sp
.ne 2
.mk
@@ -1749,9 +1784,177 @@ Verbose statistics. Reports usage statistics for individual \fIvdevs\fR within t
.rt
Omit statistics since boot. Normally the first line of output reports the statistics since boot. This option suppresses that first line of output.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-w\fR\fR
.ad
.RS 12n
.rt
Display latency histograms:
.sp
.ne 2
.mk
.na
total_wait:
.ad
.RS 20n
.rt
Total IO time (queuing + disk IO time).
.RE
.ne 2
.mk
.na
disk_wait:
.ad
.RS 20n
.rt
Disk IO time (time reading/writing the disk).
.RE
.ne 2
.mk
.na
syncq_wait:
.ad
.RS 20n
.rt
Amount of time IO spent in synchronous priority queues. Does not include
disk time.
.RE
.ne 2
.mk
.na
asyncq_wait:
.ad
.RS 20n
.rt
Amount of time IO spent in asynchronous priority queues. Does not include
disk time.
.RE
.ne 2
.mk
.na
scrub:
.ad
.RS 20n
.rt
Amount of time IO spent in scrub queue. Does not include disk time.
.RE
All histogram buckets are power-of-two sized. The time labels are the end
ranges of the buckets, so for example, a 15ns bucket stores latencies from
8-15ns. The last bucket is also a catch-all for latencies higher than the
maximum.
.RE
.sp
.ne 2
.mk
.na
\fB\fB-l\fR\fR
.ad
.RS 12n
.rt
Include average latency statistics:
.sp
.ne 2
.mk
.na
total_wait:
.ad
.RS 20n
.rt
Average total IO time (queuing + disk IO time).
.RE
.ne 2
.mk
.na
disk_wait:
.ad
.RS 20n
.rt
Average disk IO time (time reading/writing the disk).
.RE
.ne 2
.mk
.na
syncq_wait:
.ad
.RS 20n
.rt
Average amount of time IO spent in synchronous priority queues. Does not
include disk time.
.RE
.ne 2
.mk
.na
asyncq_wait:
.ad
.RS 20n
.rt
Average amount of time IO spent in asynchronous priority queues. Does not
include disk time.
.RE
.ne 2
.mk
.na
scrub:
.ad
.RS 20n
.rt
Average queuing time in scrub queue. Does not include disk time.
.RE
.RE
.sp
.ne 2
.mk
.na
\fB\fB-q\fR\fR
.ad
.RS 12n
.rt
Include active queue statistics. Each priority queue has both pending ("pend")
and active ("activ") IOs. Pending IOs are waiting to be issued to the disk, and
active IOs have been issued to disk and are waiting for completion. These stats
are broken out by priority queue:
.sp
.ne 2
.mk
.na
syncq_read/write:
.ad
.RS 20n
.rt
Current number of entries in synchronous priority queues.
.RE
.ne 2
.mk
.na
asyncq_read/write:
.ad
.RS 20n
.rt
Current number of entries in asynchronous priority queues.
.RE
.ne 2
.mk
.na
scrubq_read:
.ad
.RS 20n
.rt
Current number of entries in scrub queue.
.RE
All queue statistics are instantaneous measurements of the number of entries
in the queues. If you specify an interval, the measurements will be sampled
from the end of the interval.
.RE
.sp
.ne 2
.mk