Running hard disk tests

Learn some diagnostic methods and use them to ensure that the hardware infrastructure is in good shape. On Linux®, you can use the hdparm and dd commands or the Bonnie++ application to determine the hard disk read and write rate. You can also use the iostat command to determine average disk usage.

Determining the read rate with the hdparm command

In the Linux operating system, there is a built-in hdparm command that can be used to determine the hard disk read rate.

Procedure

In the Linux console, enter hdparm -t path_to_the_test_file
hdparm -t /dev/sda1
Timing buffered disk reads: 200 MB in 1.19 seconds = 167.47 MB/sec

Running the disk test with the DD application

About this task

The DD test measures the most basic single-threaded disk access, which is a large sequential write, followed by a large sequential read. It is relevant for the database performance testing effort because it gives you the maximum speed for sequential scans of large tables.
Note: Check the RAM size on the testing computer to correctly run a DD test and avoid file system caching that can distort the test results.

Procedure

  1. Create a file that is twice the size of the RAM capacity on the test computer and copy it to the target computer hard disk.

    In your tests use a 4 KB block size because the default page size of the DB2® table space that License Metric Tool is using is 4 KB. For example, if you have 16 GB of RAM, run the following command so that a 32 GB file named ddfile is created in the current directory:

    time sh -c "dd if=/dev/zero of=ddfile bs=4k count=8000000 && sync".
    Note: Some implementations of DD report the write rate, but the time command always returns the execution time that is larger than the DD time. The time and rate reported by DD represent the rate without any lag or synchronization time. Divide the data size by the time reported by the time command to get the real synchronous file writing rate.
    Example:
    8000000+0 records in
    8000000+0 records out
    32768000000 bytes (32 GB) copied, 38.924 s, 842 MB/s
    real 3m49.192s
    user 0m0.450s
    sys 0m38.282s
    In this example, the rate for writes including caching is 842 MB/s, but including the synchronization time it is much poorer – only about 136.46 MB/s (32 GB / 3 minutes 49 seconds).
  2. To flush out the file system cache so that you read directly from the disk later, write to the disk another large file: dd if=/dev/zero of=ddfile2 bs=4k count=4000000
  3. Read the first large file. Since the file system cache is filled with the second file, this test returns a valid read rate result:
    time dd if=ddfile of=/dev/null bs=4k
    8000000+0 records in
    8000000+0 records out
    32768000000 bytes (32 GB) copied, 186.456 seconds, 167.6 MB/s
    real 3m6.496s
    user 0m1.652s
    sys 0m10.753s
  4. Compare the results with those in the table Recommended average disk write and read rates for the database server computer to determine whether your storage can handle the DB2 database for your environment. The system should easily be able to deal with a database of up to 10000 clients.

Determining disk usage

If response times are slow, check the average disk usage with the iostat command. Disk usage times of greater than 80% can reduce I/O performance, it is desirable to have average disk usage below 40%.

Procedure

In the Linux console, enter iostat -x interval duration
Where:
  • interval is the time interval in seconds. If no interval is specified, the output reflects the values over the entire period since the system was rebooted
  • duration is the number of times to run the command.
Example:
iostat -x 30 5