|
| 1 | +Demonstrations of biolatency, the Linux eBPF/bcc version. |
| 2 | + |
| 3 | + |
| 4 | +biolatency traces block device I/O (disk I/O), and records the distribution |
| 5 | +of I/O latency (time), printing this as a histogram when Ctrl-C is hit. |
| 6 | +For example: |
| 7 | + |
| 8 | +# ./biolatency |
| 9 | +Tracing block device I/O... Hit Ctrl-C to end. |
| 10 | +^C |
| 11 | + usecs : count distribution |
| 12 | + 0 -> 1 : 0 | | |
| 13 | + 2 -> 3 : 0 | | |
| 14 | + 4 -> 7 : 0 | | |
| 15 | + 8 -> 15 : 0 | | |
| 16 | + 16 -> 31 : 0 | | |
| 17 | + 32 -> 63 : 0 | | |
| 18 | + 64 -> 127 : 1 | | |
| 19 | + 128 -> 255 : 12 |******** | |
| 20 | + 256 -> 511 : 15 |********** | |
| 21 | + 512 -> 1023 : 43 |******************************* | |
| 22 | + 1024 -> 2047 : 52 |**************************************| |
| 23 | + 2048 -> 4095 : 47 |********************************** | |
| 24 | + 4096 -> 8191 : 52 |**************************************| |
| 25 | + 8192 -> 16383 : 36 |************************** | |
| 26 | + 16384 -> 32767 : 15 |********** | |
| 27 | + 32768 -> 65535 : 2 |* | |
| 28 | + 65536 -> 131071 : 2 |* | |
| 29 | + |
| 30 | +The latency of the disk I/O is measured from the issue to the device to its |
| 31 | +completion. A -Q option can be used to include time queued in the kernel. |
| 32 | + |
| 33 | +This example output shows a large mode of latency from about 128 microseconds |
| 34 | +to about 32767 microseconds (33 milliseconds). The bulk of the I/O was |
| 35 | +between 1 and 8 ms, which is the expected block device latency for |
| 36 | +rotational storage devices. |
| 37 | + |
| 38 | +The highest latency seen while tracing was between 65 and 131 milliseconds: |
| 39 | +the last row printed, for which there were 2 I/O. |
| 40 | + |
| 41 | +For efficiency, biolatency uses an in-kernel eBPF map to store timestamps |
| 42 | +with requests, and another in-kernel map to store the histogram (the "count") |
| 43 | +column, which is copied to user-space only when output is printed. These |
| 44 | +methods lower the perormance overhead when tracing is performed. |
| 45 | + |
| 46 | + |
| 47 | +In the following example, the -m option is used to print a histogram using |
| 48 | +milliseconds as the units (which eliminates the first several rows), -T to |
| 49 | +print timestamps with the output, and to print 1 second summaries 5 times: |
| 50 | + |
| 51 | +# ./biolatency -mT 1 5 |
| 52 | +Tracing block device I/O... Hit Ctrl-C to end. |
| 53 | + |
| 54 | +06:20:16 |
| 55 | + msecs : count distribution |
| 56 | + 0 -> 1 : 36 |**************************************| |
| 57 | + 2 -> 3 : 1 |* | |
| 58 | + 4 -> 7 : 3 |*** | |
| 59 | + 8 -> 15 : 17 |***************** | |
| 60 | + 16 -> 31 : 33 |********************************** | |
| 61 | + 32 -> 63 : 7 |******* | |
| 62 | + 64 -> 127 : 6 |****** | |
| 63 | + |
| 64 | +06:20:17 |
| 65 | + msecs : count distribution |
| 66 | + 0 -> 1 : 96 |************************************ | |
| 67 | + 2 -> 3 : 25 |********* | |
| 68 | + 4 -> 7 : 29 |*********** | |
| 69 | + 8 -> 15 : 62 |*********************** | |
| 70 | + 16 -> 31 : 100 |**************************************| |
| 71 | + 32 -> 63 : 62 |*********************** | |
| 72 | + 64 -> 127 : 18 |****** | |
| 73 | + |
| 74 | +06:20:18 |
| 75 | + msecs : count distribution |
| 76 | + 0 -> 1 : 68 |************************* | |
| 77 | + 2 -> 3 : 76 |**************************** | |
| 78 | + 4 -> 7 : 20 |******* | |
| 79 | + 8 -> 15 : 48 |***************** | |
| 80 | + 16 -> 31 : 103 |**************************************| |
| 81 | + 32 -> 63 : 49 |****************** | |
| 82 | + 64 -> 127 : 17 |****** | |
| 83 | + |
| 84 | +06:20:19 |
| 85 | + msecs : count distribution |
| 86 | + 0 -> 1 : 522 |*************************************+| |
| 87 | + 2 -> 3 : 225 |**************** | |
| 88 | + 4 -> 7 : 38 |** | |
| 89 | + 8 -> 15 : 8 | | |
| 90 | + 16 -> 31 : 1 | | |
| 91 | + |
| 92 | +06:20:20 |
| 93 | + msecs : count distribution |
| 94 | + 0 -> 1 : 436 |**************************************| |
| 95 | + 2 -> 3 : 106 |********* | |
| 96 | + 4 -> 7 : 34 |** | |
| 97 | + 8 -> 15 : 19 |* | |
| 98 | + 16 -> 31 : 1 | | |
| 99 | + |
| 100 | +How the I/O latency distribution changes over time can be seen. |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +The -Q option begins measuring I/O latency from when the request was first |
| 105 | +queued in the kernel, and includes queuing latency: |
| 106 | + |
| 107 | +# ./biolatency -Q |
| 108 | +Tracing block device I/O... Hit Ctrl-C to end. |
| 109 | +^C |
| 110 | + usecs : count distribution |
| 111 | + 0 -> 1 : 0 | | |
| 112 | + 2 -> 3 : 0 | | |
| 113 | + 4 -> 7 : 0 | | |
| 114 | + 8 -> 15 : 0 | | |
| 115 | + 16 -> 31 : 0 | | |
| 116 | + 32 -> 63 : 0 | | |
| 117 | + 64 -> 127 : 0 | | |
| 118 | + 128 -> 255 : 3 |* | |
| 119 | + 256 -> 511 : 37 |************** | |
| 120 | + 512 -> 1023 : 30 |*********** | |
| 121 | + 1024 -> 2047 : 18 |******* | |
| 122 | + 2048 -> 4095 : 22 |******** | |
| 123 | + 4096 -> 8191 : 14 |***** | |
| 124 | + 8192 -> 16383 : 48 |******************* | |
| 125 | + 16384 -> 32767 : 96 |**************************************| |
| 126 | + 32768 -> 65535 : 31 |************ | |
| 127 | + 65536 -> 131071 : 26 |********** | |
| 128 | + 131072 -> 262143 : 12 |**** | |
| 129 | + |
| 130 | +This better reflects the latency suffered by the application (if it is |
| 131 | +synchronous I/O), whereas the default mode without kernel queueing better |
| 132 | +reflects the performance of the device. |
| 133 | + |
| 134 | +Note that the storage device (and storage device controller) usually have |
| 135 | +queues of their own, which are always included in the latency, with or |
| 136 | +without -Q. |
| 137 | + |
| 138 | + |
| 139 | +USAGE message: |
| 140 | + |
| 141 | +# ./biolatency -h |
| 142 | +usage: biolatency [-h] [-T] [-Q] [-m] [interval] [count] |
| 143 | + |
| 144 | +Summarize block device I/O latency as a histogram |
| 145 | + |
| 146 | +positional arguments: |
| 147 | + interval output interval, in seconds |
| 148 | + count number of outputs |
| 149 | + |
| 150 | +optional arguments: |
| 151 | + -h, --help show this help message and exit |
| 152 | + -T, --timestamp include timestamp on output |
| 153 | + -Q, --queued include OS queued time in I/O time |
| 154 | + -m, --milliseconds millisecond histogram |
| 155 | + |
| 156 | +examples: |
| 157 | + ./biolatency # summarize block I/O latency as a histogram |
| 158 | + ./biolatency 1 10 # print 1 second summaries, 10 times |
| 159 | + ./biolatency -mT 1 # 1s summaries, milliseconds, and timestamps |
| 160 | + ./biolatency -Q # include OS queued time in I/O time |
0 commit comments