Identifying Poor Disk Performance

One clue to poor disk performance is poor overall system performance, particularly at disk-intensive tasks such as launching large programs. Unfortunately, there are so many differences between computers that it may not be obvious when a system's performance is just slightly lacking. A severely mistuned system, though—say, one using the ancient ATA-1 mode—is likely to catch your attention as being sluggish.

To test your disk's performance, use the hdparm utility. This program's main purpose is to display and set various ATA parameters that influence performance. The program can also run basic performance tests. The -t parameter tests disk read speed, while the -T parameter tests Linux's disk cache performance. Essentially, -T is a test of the computer's memory and CPU speed. The cache speed is important to overall disk performance, but for purposes of testing, you don't want the cache to interfere with raw disk performance tests. You can combine the two tests, and hdparm will apply correction factors to separate the two measures. Following the -Tt parameter, you specify the hard disk you want to test as follows:

Timing buffer-cache reads: 128 MB in 0.58 seconds =220.69 MB/sec Timing buffered disk reads: 64 MB in 2.36 seconds = 27.12 MB/sec

In order to get reliable results, you should perform these tests on a system that's otherwise not doing much, and especially not performing any disk-intensive tasks. It's also best to perform the test at least three times so that you can spot any outliers that might be caused by events such as cron jobs causing aberrant performance on a single run.

What's poor performance, though? This depends on the disk. You should be able to find detailed specifications for your disk on the manufacturer's website. You need to find the specification for sustained transfer speeds to and from the disk's media (aka "internal" speeds). In early 2003, most new drives nominally produce maximum speeds of 30-100MB/S. Actual speeds are likely to be between 50 percent and 75 percent of the nominal speed, though, because manufacturers report absolute best-case speed scenarios. Speeds also vary from one part of the disk to another; the outermost tracks produce better speeds than the innermost tracks, because disk manufacturers place more sectors on outer tracks than inner ones.

Warning Disk manufacturers often prominently advertise their disk interface speeds, such as 100MB/S. Media transfer rates are more important, though, and manufacturers often hide this information on data sheets. Also, manufacturers sometimes measure disk performance in megabits per second (Mbps), but hdparm reports its results in megabytes per second (MB/s). Divide megabits per second by 8 to obtain the value in megabytes per second.

If you believe your disk speed is deficient, you should search for a reason for the problem. In the case of ATA disks, the -v parameter to hdparm produces a summary of disk settings:

multcount =16 (on) IO_support = 1 (32-bit) unmaskirq = 1 (on) using_dma = 1 (on) keepsettings = 0 (off) readonly = 0 (off) readahead = 8 (on)

geometry = 9729/255/63, sectors = 156301488, start = 0

The most important setting displayed by this output is the using_dma item. This setting reveals whether the controller is using direct memory access (DMA) mode, in which the controller directly transfers data between the disk and the computer's memory. The alternative is programmed input/output (PIO) mode, in which the computer's CPU mediates all transfers. DMA mode is generally faster than PIO mode, and DMA transfers impose a lower CPU load, so disk accesses need not slow down CPU-intensive programs as much.

You can also check pseudo-files in the /proc/ide directory tree for information on disk configuration. In particular, examine the /proc/ide/hdx/settings file, where hdx is the code for the drive in question, such as hda for the first drive. You'll find the settings shown by hdparm -v, as well as more, such as current_speed, which reveals the current top speed setting for the drive. Even if the system is set to use DMA mode, if the current_speed setting is very low, it may be the cause of a performance bottleneck.

0 0

Post a comment