Using the fileops read Probe

Example 11-8 Displaying Read Latencies With the read Probe

You can use the read probe to observe read latencies on different file system types. For example:

fileops:::read
{
        @[args[0]->fi_fs] = quantize(args[1]);
}

Running the example script on a server for several seconds generates an output similar to the following example:

# dtrace -s ./read-latency-by-fs.d
dtrace: script './read-latency-by-fs.d' matched 1 probe
^C

  tmpfs
           value  ------------- Distribution ------------- count
              64 |                                         0
             128 |@@@@@@@@@                                2
             256 |@@@@                                     1
             512 |                                         0
            1024 |                                         0
            2048 |                                         0
            4096 |                                         0
            8192 |@@@@@@@@@@@@@@@@@@                       4
           16384 |@@@@@@@@@                                2
           32768 |                                         0

  procfs
           value  ------------- Distribution ------------- count
            1024 |                                         0
            2048 |@@@@@@@                                  2
            4096 |                                         0
            8192 |@@@@@@@@@@@@@@@@@@                       5
           16384 |@@@@@@@@@@@@@@@                          4
           32768 |                                         0

  nfs3
           value  ------------- Distribution ------------- count
             128 |                                         0
             256 |@@@@                                     6
             512 |@@@                                      5
            1024 |@@@@@                                    7
            2048 |@@@@@@@@@@@@@@                           21
            4096 |@@@@@@@                                  10
            8192 |@@@@@@@@                                 12
           16384 |                                         0

  sockfs   
           value  ------------- Distribution ------------- count
             128 |                                         0
             256 |@@@@@                                    16
             512 |@@@@@@@@                                 27
            1024 |@@@@@@@                                  24
            2048 |@@@@@@@@@@@                              38
            4096 |@@                                       8
            8192 |@@@@@@@                                  23
           16384 |                                         1
           32768 |                                         0
           65536 |                                         0
          131072 |                                         0
          262144 |                                         0
          524288 |                                         0
         1048576 |                                         0
         2097152 |                                         1
         4194304 |                                         0

  fifofs
           value  ------------- Distribution ------------- count
              32 |                                         0
              64 |                                         1
             128 |@@@                                      8
             256 |@@@@@                                    13
             512 |@@                                       6
            1024 |@@                                       4
            2048 |@@                                       4
            4096 |@@@@@@@                                  18
            8192 |@                                        2
           16384 |@@@                                      8
           32768 |                                         1
           65536 |@                                        3
          131072 |                                         0
          262144 |                                         0
          524288 |@                                        2
         1048576 |                                         1
         2097152 |@@                                       6
         4194304 |@@@@@@@                                  17
         8388608 |@                                        2
        16777216 |                                         0
        33554432 |                                         1
        67108864 |                                         1
       134217728 |                                         0

  zfs
           value  ------------- Distribution ------------- count
             256 |                                         0
             512 |@                                        85
            1024 |@@                                       275
            2048 |@                                        116
            4096 |@@@@@@                                   982
            8192 |@@@@@@@@@@@@                             1963
           16384 |                                         72
           32768 |                                         34
           65536 |                                         2
          131072 |                                         39
          262144 |                                         3
          524288 |                                         0
         1048576 |                                         53
         2097152 |@@                                       351
         4194304 |@@@@@@@@@                                1360
         8388608 |@@@@@@                                   1011
        16777216 |                                         18
        33554432 |                                         6
        67108864 |                                         2
       134217728 |                                         3
       268435456 |                                         2
       536870912 |                                         0

In this example, you can see that memory-resident file systems such as tmpfs and pseudo-file systems such as procfs satisfy read requests very quickly. You can also see that file systems such as zfs have a bi-modal distribution. Reads that are satisfied from the in-memory cache happen very quickly and the reads that must go to disk are orders of magnitude slower.

Example 11-9 Displaying the Distribution of Write Sizes With the write Probe

You can use the write probe to observe the distribution of write sizes on the system, independent of file system type. For example:

fileops:::write
{
        @ = quantize(args[4]);
}

Running this briefly on a small server generates an output similar to the following:

# dtrace -s ./write-size.d
dtrace: script './write-size.d' matched 1 probe
^C


           value  ------------- Distribution ------------- count    
              -1 |                                         0        
               0 |                                         2        
               1 |@@@@@@@@@@                               190      
               2 |                                         5        
               4 |@                                        16       
               8 |@                                        20       
              16 |@                                        24       
              32 |@@@@                                     80       
              64 |@@@@@@@@@@@@@                            253      
             128 |@@@@@                                    96       
             256 |@@                                       48       
             512 |                                         3        
            1024 |@@                                       34       
            2048 |                                         2        
            4096 |                                         0        
            8192 |                                         3        
           16384 |                                         0