|
One of the factors that determine file system performance is the type and configuration of hard disks on your system. The information in this section can be used to determine the performance of the hard disks on your system and to help you choose new hard disks that meet your performance needs. Later in this chapter, the "hdparm" section discusses how to control the settings to specify Integrated Drive Electronics (IDE) hard drives. Physical Disk Storage ConsiderationsThe physical movement of data consumes a great amount of time relative to the processing of that data. Data movement components include the following:
In this list, each operation is substantially faster than the previous one, due to the relative speeds of the technological components involved in delivering each. Because data access can require all the steps, the total elapsed time for the data movement is the sum of all of the preceding. There are two ways to increase performance by tuning data access and movement:
As in all other performance tuning, changes implemented to improve data access speed can impact some other aspects of the system. In general, measure the performance before any change is made, implement each change separately, and measure the performance after the change. Disk AnatomyDespite the dramatic advances in the performance and price of microprocessors and memory, disks are still mechanical devices. As such, they are slow and complex. Because the physical characteristics of a disk drive impact many of the performance tuning considerations, it is important to be aware of some of the key areas involved with a disk drive. Two significant features impact disk performance:
All other things being equal, the faster the rotation rate, the more data that moves under the head in a given amount of time, the more data the head reads, and the higher the sustained throughput will be. However, rotation rates don't compare as neatly as they might, because all other things are not usually equal. For example, a 5.25-inch disk platter has, on average, a larger circumference for its tracks than a 3.5-inch drive. That translates to more room for data on the tracks and more data passing under the head during each rotation. Another variable is the density of data along the tracks. If a drive has a high-enough density, it can have more data passing under the head in a given amount of timeand therefore a faster sustained transfer ratethan another drive with a faster rotation rate but a lower density. As a rule of thumb, faster rotation translates into a faster sustained transfer rate, but the difference might not be as great as a simple comparison of the rotation rates implies. Rotation rate also affects average access time, because one of the two components of access timelatencyis determined by the amount of time it takes the disk to rotate to the right location on a track under the drive head after the drive head has reached the right track. The faster the rotation rate, the lower the latency, and the faster the access time. Transfer RateThere are several kinds of transfer rates. They are not interchangeable.
The transfer rate that is seen most often is the burst transfer rate, because it is the most impressive number of the three. However, the number that matters the most is the sustained transfer rate, which essentially tells you how quickly large amounts of data can move to and from the drive. Most of the time, the drive has to read from or write to the disk platter itself, which means that the sustained transfer rate depends primarily on how quickly the drive can move data between the drive head and the disk. Sometimes specifications give a minimum, maximum, and average sustained transfer rate. The difference comes from the fact that the outer tracks of a disk platter have more data, so more data passes under the drive head during a single rotation when reading from the outside tracks than when reading from the inside tracks. Maximum sustained transfer rate is the transfer rate for the outer tracks. The minimum is the transfer rate for the inner tracks. The average is the average over the entire disk. Other factors that affect transfer rate include the density of the data on the disk and the speed of rotation. The sustained transfer rate is equal to the internal transfer rate minus whatever overhead the drive needs for transfer operations. hdparmhdparm controls the settings of IDE hard drives, both in the kernel and for the drive itself. This section summarizes the various settings that are usually set to off by default, and what you can do to turn them on safely to increase the performance of your hard drive. Skip this section if you do not have IDE drives. Read the hdparm man page, which provides detailed information on most of the options, before using hdparm. To view information about a drive, issue hdparm without any options, as shown here on sample drive /dev/hdb: # hdparm /dev/hdb This command produces output like the following: /dev/hdb: multcount = 16 (on) IO_support = 0 (default 16-bit) unmaskirq = 0 (off) using_dma = 1 (on) keepsettings = 0 (off) readonly = 0 (off) readahead = 8 (on) geometry = 1650/255/63, sectors = 26520480, start = 0 The following list provides a brief description of the fields:
To display general information about the drive's actual capabilities, use the i option: # hdparm -i /dev/hdb This command produces output like the following: /dev/hdb: Model=IBM-DJNA-371350, FwRev=J76IA30K, SerialNo=GM0GMGY8991 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=34 BuffType=DualPortCache, BuffSize=1966kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=26520480 IORDY=on/off, tPIO={ min:240,w/IORDY:120} , tDMA={ min:120, rec:120} PIO modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 UDMA modes: udma0 udma1 *udma2 udma3 udma4 AdvancedPM=no WriteCache=enabled Drive conforms to: ATA/ATAPI-4 T13 1153D revision 17:1 2 3 4 One value that is worth examining is MaxMultSect. This field specifies the maximum number of sectors the hard disk can read at a time. The sample output shows that for drive /dev/hdb MaxMultSect is set to 16. Most IDE hard drives made in the past few years support 32-bit access. If your hard disk supports 32-bit access, you want this value to be 32. The following command sets the MaxMultSect value to 32: # hdparm -c 1 /dev/hdb The number 1 turns MaxMultSect on; the number 0 turns MaxMultSect off. MaxMultSect is usually off by default. The default value is 16. Test your hard drive's performance both before and after setting these various commands by typing the following: # hdparm -T -t /dev/hdb This command produces output like the following: /dev/hdb: Timing buffer-cache reads: 128MB in 0.97 seconds=131.96MB/sec Timing buffered disk reads: 64MB in 3.80 seconds=16.84 MB/sec The next field to look at is the drive's write caching. The command to turn on write caching is as follows: # hdparm -W 1 /dev/hdb The number 1 turns write caching on; the number 0 turns write caching off. Another useful option to hdparm is using_dma. The command to turn dma on is the following: # hdparm -d 1 /dev/hdb This command produces output like the following: /dev/hdb: setting using_dma to 1 (on) using_dma = 1 (on) The number 1 turns using_dma on; the number 0 turns using_dma off. None of these settings is saved over a reboot. You have to add the appropriate commands to your /etc/rc.d/rc.sysinit file if you are using Red Hat to be sure they are run automatically on startup. If you are not running a Red Hat distribution, an easy way to find the file to change is to do a grep in the /etc directory, as shown in the following example: # cd /etc # grep -r hdparm . | more After you find the configuration file that sets the options through hdparm, change that file to use the new parameters that were set with hdparm. It is a good idea to run with the new settings for a while to ensure they are right for the system before they are permanently updated in a configuration file. |
|