Linux - speed up your IDE hard drive
Linux systems usually use conservative default
IDE driver settings that could be significantly slowing down your system. By default
they are set to most safe settings guaranteed to work. However you may
reconfigure them to increase the read speed of your hard drive. In most cases
this will not speed up serving of your website significantly, but it is nice to
know that you can get the most out of your hardware.
To benchmark the read speed of your IDE drive execute
the following
>root@newserver [~]# hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 696 MB in 2.00 seconds = 348.00 MB/sec
Timing buffered disk reads: 60 MB in 3.00 seconds =
19.80 MB/sec
Timing buffered disk reads can be very slow. This may be as a result of
high CPU load or extensive hard disk swapping. Check apache optimization section
first if the read time is too slow.
Now lets' see what are the Input/Output settings
of your hard disk. Execute the command /sbin/hdparm -v /dev/hda
# /sbin/hdparm -v /dev/hda
/dev/hda:
multcount = 16 (on)
IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 9729/255/63, sectors = 156301488, start = 0
This are the current driver settings settings.
Lets see what your hard drive is capable of. Execute the command /sbin/hdparm
-i /dev/hda
root@cpanel [~]# /sbin/hdparm -i /dev/hda
/dev/hda:
Model=ST380011A, FwRev=3.06, SerialNo=5JV18H2Q
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=2048kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
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 *udma5
AdvancedPM=no WriteCache=enabled
Drive conforms to: ATA/ATAPI-6 T13 1410D revision 2:
* signifies the current active mode
Significant I/O performance increase has been
reported when setting drivers to DMA, 32-bit tranfers and multisector mode. Note
that the drive support DMA modes. Lets turn DMA mode on, this will speed up
timing buffered read by a factor of two
#/sbin/hdparm -d1 /dev/hda
#/sbin/hdparm -c3 /dev/hda (I/O support set to 3 - turn on 32bit
transfers on your first HD by typing )
#/sbin/hdparm -m16 /dev/hda (choose data transfer parameters 16 as MaxMultSect=16)
#/sbin/hdparm -a16 /dev/hda (choose read ahead setting 16 as MaxMultSect=16)
Benchmark the hard drive performance again.
root@cpanel [~]# /sbin/hdparm -Tt /dev/hda
/dev/hda:
Timing buffer-cache reads: 724 MB in 2.00 seconds = 362.00 MB/sec
Timing buffered disk reads: 154 MB in 3.01 seconds = 51.16 MB/sec
Lastly you may tweak UltraDMA settings for
those who have Mode3/4 IDE controllers with EIDE or UDMA HDs. It is possible to
enable the Mode3 or Mode4 PIO and UDMA. This is too risky in my opinion for a
web server so we skip this part. In a sample above UDMA is already enabled.
Still the server load is too high?
If you are running dynamic pages on your server
you may look into mySQL and Php settings optimization.
Apache
httpd.conf optimization |
linux hard disk optimization
| MySQL and PHP optimization
|