Performance and Tuning
   --Hard drive tuning
   --Disable unnecessary services


Hard drive tuning
By using the utility hdparm, one can view the current performance of
your hard drive and also tune it. 

***Always back up your drive before using.  I've had no problems
but if you do.......I cant be blamed :) ***

First see what your drive specifications are using the following command:

[root@blueox]# /sbin/hdparm -i /dev/hda

/dev/hda:

Model=IC25N080ATMR04-0, FwRev=MO4OAD4A, SerialNo=MRG40HK4HW9S9H
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=DualPortCache, BuffSize=7884kB, 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=yes: mode=0x80 (128) WriteCache=enabled
Drive conforms to: ATA/ATAPI-6 T13 1410D revision 3a:

* signifies the current active mode

Next see how Linux accesses your drive:

[root@blueox]# /sbin/hdparm /dev/hda

/dev/hda:
multcount = 16 (on)
IO_support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 16383/255/63, sectors = 80026361856, start = 0

From the above information, IO support is set at 16-bit.  This will be changed
to 32-bit.

The first test will measure the performance of your cache using the command:
/sbin/hdparm -Tt /dev/hda
The -T switch performs timings for cache reads while -t performs timings for device reads.

[root@blueox]# /sbin/hdparm -Tt /dev/hda

/dev/hda:
Timing cached reads: 1516 MB in 2.00 seconds = 756.22 MB/sec
Timing buffered disk reads: 74 MB in 3.02 seconds = 24.47 MB/sec

Next, IO support will be changed to 32bit using the -c1 switch.

[root@blueox]# /sbin/hdparm -c1 /dev/hda

/dev/hda:
setting 32-bit IO_support flag to 1
IO_support = 1 (32-bit)


Check to make sure the settings were changed properly:

[root@blueox]# /sbin/hdparm /dev/hda

/dev/hda:
multcount = 16 (on)
IO_support = 1 (32-bit)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 16383/255/63, sectors = 80026361856, start = 0

Now see if there was any speedup:

[root@blueox]# /sbin/hdparm -Tt /dev/hda

/dev/hda:
Timing cached reads: 1648 MB in 2.00 seconds = 823.71 MB/sec
Timing buffered disk reads: 76 MB in 3.12 seconds = 24.35 MB/sec

It's about a 9% speedup in cache reads.  Disk reads remain closely the same.


Disable unnecessary services


There are several reason why disabling unnecessary services is beneficial.  The
first being it lowers your security risk.  If you don't have a certain exploitable
service running, it can't be used against you.  If there is an ssh exploit but you don't
have the ssh daemon running, a hacker can't use that exploit on you.  Simply enough.
Another reason is to increase system performance.  Just by disabling unnecessary
services, I took around 12 seconds off my boot time.

So this is how I disable services.  First, open a shell, become root and open up
system-config-services.

[root@blueox]# system-config-services

This will bring up a gui thats lists what services are running and which ones are
available to you.  Deselect the services you do not need, click the Save button, and exit. 
Next time you reboot your computer things should start up a little quicker and overall
system performance should be a little snappier. 

The services that I have running are listed below:

acpid - Listen and dispatch ACPI events from the kernel
anacron - Run cron jobs that were left out due to downtime
cpuspeed - Run dynamic CPU speed daemon
crond - Runs user specified programs at scheduled times
cups - script for Common Unix Printing System, use if you print
cups-config-daemon - another printing daemon
firestarter - gui for the firewall
haldaemon - collects hardware information
iptables - ALWAYS have running, its the firewall
irqbalance - used to spread load on multiprocessor systems
lm_sensors - monitors motherboard sensors
messagebus - broadcasts system events
network - activates network during boot time
pcmcia - used by laptops
readahead - increases startup performance by loading programs in memory before needed
readahead_early - see above
smartd - Self Monitoring and Reporting Technology daemon - not too sure yet about this
syslog - always have on, other daemons use this to create system logs
xinetd