RAWIO(1)

NAME
rawio - Test performance of low-level storage devices

SYNOPSIS
rawio [-a] [-c transfer-count] [-f] [-h] [-I name] [-n record-count] [-p process-count] [-R] [-r] [-s size] [-v verbosity] [-W] [-w] special

DESCRIPTION
rawio tests the speed of the low-level character I/O device special in a concurrent environment. It is intended for comparisons of storage devices on a single system, and is not suited for cross-platform performance testing.

By default, rawio spawns eight processes, each of which performs the same test. Four tests are available:

Random Read
    The random read test reads varying length records from the specified device special, starting at random positions within the file. The offset is necessary to protect the disk label and any possible future extensions.

Sequential Read
    The sequential read test reads constant length records from the specified device special, starting at offset 32 sectors the beginning of the file.

Random Write
    The random write test writes varying length records to the specified device special, starting at random positions within the file. THIS TEST OVERWRITES DATA ON THE SPECIAL DEVICE. DO NOT USE IT ON A DRIVE WHICH CONTAINS IMPORTANT DATA..

Sequential Write
    The sequential write test writes constant length records to the specified device special, starting at offset 32 sectors the beginning of the file. The offset is necessary to protect the disk label and any possible future extensions. THIS TEST OVERWRITES DATA ON THE SPECIAL DEVICE. DO NOT USE IT ON A DRIVE WHICH CONTAINS IMPORTANT DATA..

If no tests are specified with the options -R, -r, -W or -w, rawio performs the random read and the sequential read tests, which are non-destructive.

rawio resembles bonnie in some of the things it does. It differs strongly from bonnie by using a raw disk device, which bypasses buffer cache. As a result, some of the tests that bonnie performs are meaningless, for example character I/O.

OPTIONS

-a  Perform all tests (Random Read, Sequential Read, Random Write, Sequential Write).

-c transfer-count
    Specify the length of sequential transfers or the average length of random transfers. The length of a random transfer can be up to twice this value. It may be specified either in sectors (<512) or in bytes (>= 512), and must be an integral number of sectors. This value defaults to 16384 bytes (32 sectors). The maximum value is system-dependent. On FreeBSD it is 256 sectors (131072 bytes).

-f  When performing sequential transfers, start all the transfers at the same offset into the device. This has a dramatic effect on the throughput. See INTERPRETING THE RESULTS below for a discussion of this flag.

-h  Suppress headings in the output. This can be useful to create output files intended for processing by plotting utilities.

-I name
    Specify a name to be written in the results to identify the test. If this option is omitted, rawio uses the name of the drive.

-n record-count
    Specify the total number of records to transfer. The default value is 16384. If the number is not divisible by the number of processes, the first remainder processes transfer one extra record.

    The sequential transfer tests will stop at the end of the device, which may result in fewer records than indicated being transferred.

-p process-count
    Specify the number of processes to start. The default value is 8.

-R  Perform a Random Read test, identified as RR in the output. This flag may be used in combination with other test specification flags.

-r  Perform a Sequential Read test, identified as SR in the output. This flag may be used in combination with other test specification flags.

-S  When performing the random tests, use pseudo-random data from an internal table instead of calling the random number generator. This makes the results more predictable and thus more repeatable. This can be of use when comparing results on different platforms, though it is not clear that the differences in the random numbers generated play a significant factor in the differences between consecutive measurements.

-s size
    Specify the size of special in bytes. rawio tries several different ways to determine the size of the device, but it is possible that all will fail. In this case, you should specify it manually. This value will override any attempt to determine the size programmatically, so it can also be of use to restrict the part of the device used by the random seek tests.

-v verbosity
    Specify that more verbose output is desired. verbosity is an integer specifying the amount of information desired. Currently the only value which makes any difference is 1.

-W  Perform a Random Write test, identified as RW in the output. This flag may be used in combination with other test specification flags. THIS TEST OVERWRITES DATA ON THE SPECIAL DEVICE. DO NOT USE IT ON A DRIVE WHICH CONTAINS IMPORTANT DATA..

-w  Perform a Sequential Write test, identified as SW in the output. This flag may be used in combination with other test specification flags. THIS TEST OVERWRITES DATA ON THE SPECIAL DEVICE. DO NOT USE IT ON A DRIVE WHICH CONTAINS IMPORTANT DATA..

OUTPUT FORMAT
rawio can produce three different styles of output. Without the -v option, rawio produces the following kind of output:

            Random read     Sequential read Random write    Sequential write
    ID          K/sec  /sec    K/sec  /sec     K/sec  /sec     K/sec  /sec
    rawdisk      81.0     5    149.4     5      88.1     6     129.1     4

Each test produces only a single line of output. The values for each test are the throughput in kilobytes per second, and the number of transfers per second.

With the -v 1 option, rawio produces the following style of output:

    Test    ID          K/sec       %User    %Sys  %Total  I/Os
    RR     da0c        1200.8         0.2     2.4     2.6  800
    SR     da0c         944.0         0.1     0.7     0.9  800
    RW     da0c        1380.3         0.2     2.8     3.0  800
    SW     da0c         947.8         0.0     0.8     0.9  800

The first column is an abbreviation for the test. See the test descriptions above. The second column is the identifier for the test, which in this example defaults to the name of the disk, da0c because none had been specified.

The third column shows the aggregate data transfer speed. The fields %User, %Sys and %Total show the percentage user, system and total (user + system) CPU time used by the processes. The field I/Os shows the number of I/O requests issued to special.

The verbose output prints the following information:

    Test name:                sample
    Transfer count:            32768
    Record count:                100
    Process count:                 8
    Device size:          1648000000
    Test    ID         Time    K/sec   %User    %Sys  %Total  Reads   Writes
    RR   sample   10.143686   1243.1     0.1     2.6     2.8  800     0
    SR   sample   27.822950    942.1     0.0     0.8     0.9  800     0
    RW   sample    9.470939   1321.3     0.1     2.8     2.8  0       800
    SW   sample   27.719114    945.7     0.0     0.9     0.9  0       800

The time field shows the elapsed time for the complete test, and the columns Reads and Writes show itemized information about the I/Os. This format is likely to change and become more useful.

Either format is intended to make it easy to extract test information from a log file. For example, to extract information on a specific test on different devices, you can enter:

    $ grep ^RR stripe.1.log
    RR      s1k         220.8         0.0     2.2     2.2  512
    RR      s2k         386.2         0.1     2.0     2.0  512
    RR      s4k         620.6         0.2     2.2     2.3  512
    RR      s8k         881.3         0.2     2.4     2.6  512
    RR     s16k        1083.6         0.2     2.7     2.9  512
    RR     s32k        1192.2         0.3     2.5     2.8  512
    RR     s64k        1239.9         0.1     2.9     3.1  512
    RR    s128k        1306.8         0.4     2.8     3.1  512
    RR    s256k        1346.0         0.8     2.5     3.2  512
    RR    s512k        1360.8         0.0     3.0     3.0  512
    RR      s1m        1363.7         0.0     3.2     3.2  512
    RR      s2m        1387.9         0.1     2.8     2.9  512
    RR      s4m        1357.6         0.2     2.8     3.1  512

To extract information on a specific test,

    $ grep s128k stripe.1.log
    SR    s128k        1719.1         0.0     1.7     1.7  512
    RR    s128k        1306.8         0.4     2.8     3.1  512
    SW    s128k        2126.9         0.1     2.1     2.2  512
    RW    s128k        1516.4         0.0     3.4     3.4  512

INTERPRETING THE RESULTS
rawio is designed to simulate the behaviour of real-world storage devices in some common situations. When analysing the results, it is important to understand these situations.

Random file access
    Relatively true random access situations, such as are demonstrated by the random read and write tests, occur with web page accesses. Many database applications also behave in this manner. In each case, the issue is complicated by directory or index access, so this test is idealized.

    In this test, the number of processes should be set to the approximate number of requestors. Performance will usually show an improvement with increasing number of requestors. This performance improvement will lessen with increasing number of processes, and may show a drop with a large number. This drop can be attributed to a large number of factors, not the least of which is natural measurement error.

Sequential file access
    True sequential file access occurs when the disk subsystem reads sequential blocks off a disk. It is extremely rare in a large system: it implies that only one process is doing the reading. As soon as two processes read, even if they are reading the same file sequentially, the access is no longer purely sequential as seen by the disk. Instead, multiple read requests are issued for the same spatially related blocks.

    Even this kind of access is relatively rare. First, the file system buffer cache will generally resolve these issues, so only one read will be issued. Secondly, typical ``sequential access'' is more typified by an ftp server or streaming video server, where multiple processes read relatively large files in a sequential manner. This is the model which the rawio sequential access tests perform by default. If you want to test multiple sequential access to the same area of disk, use the -f flag.

    The normal sequential access tests show a marked decrease in performance with increasing number of requestor processes. This is because the access becomes more and more random with increasing number of requestors. On the other hand, with the -f flag, performance improves dramatically with increasing number of requestors, since now the on-device cache can satisfy most requests. With 8 requestors, performance improvements of 3000% to 4000% can be expected. This is the scenario that RAID array vendors like to show, since it can show really dramatic performance. Unfortunately, the figures are almost meaningless.

The effect of transfer size
    Modern storage devices transfer data at between 10 MB/s and 80 MB/s. A typical transfer of 8 kB thus takes between 100 υs and 800 υs. By contrast, typical positioning latency is in the order of 8 ms, between 10 and 80 times as long. Obviously the size of the transfer strongly affects the throughput. Unfortunately, it is often difficult to influence the transfer size. Text web pages, for example, tend to be less than 16 kB in size. ftp files and image data are larger, but it's often difficult to persuade the system to transfer in larger quantities; a lot depends on the program performing the access. It's beyond the scope of this man page to discuss methods of improving performance, but rawio provides the mechanism for measuring the potential differences. By obvservation, the average transfer size for ufs is between 6 kB and 7 kB.

GOTCHAS
rawio measures I/O system performance, so you should use it against the raw disk device. It will work against block devices, but you'll be measuring the performance of buffer cache, not the underlying device.

The rawio write tests overwrite the data on the device. Don't use them on devices containing data you care about.

SEE ALSO
bonnie(1), iozone(1), iostat(8)

AUTHOR
Greg Lehey <grog@lemis.com>.