Several components in a Linux environment are candidates for disk read aheads.
Database: Turn off tablespace prefetching
for randomized OLTP workloads. Prefetching reads in data needed by a query
prior to it being referenced by the query, so that the query need not wait
for I/O to be performed. Turning off tablespace prefetching avoids unnecessary
overhead for the additional read ahead requests, which results in a higher
transaction rate per second for the OLTP workloads.
LVM: For a randomized OLTP workload it makes sense to
turn off the read ahead sectors, if the database files
reside on a Logical Volume. Thus you avoid unnecessary overhead for the
additional read ahead requests, which results in a higher transaction rate
per second for the OLTP workload.
How to turn off the read ahead sectors for a Logical Volume using lvchange:
# lvchange -r 0 /dev/scsi_lvm2_vg/scsi_lvm2_lv
lvchange -- logical volume "/dev/scsi_lvm2_vg/scsi_lvm2_lv" changed
lvchange -- doing automatic backup of volume group "scsi_lvm2_vg"
# lvdisplay /dev/scsi_lvm2_vg/scsi_lvm2_lv
--- Logical volume ---
LV Name /dev/scsi_lvm2_vg/scsi_lvm2_lv
VG Name scsi_lvm2_vg
LV Write Access read/write
LV Status available
LV # 1
# open 1
LV Size 232.62GB
Current LE 59550
Allocated LE 59550
Stripes 25
Stripe size (KByte) 32
Allocation next free
Read ahead sectors 0
Block device 58:1
Linux block device layer
Linux kernel 2.4
Leave the value as is, it is dynamically adapted by Linux. The value
can be queried or changed using the Linux blockdev command.
Linux kernel 2.6
Set the value to 0 using the blockdev command, for example blockdev --setra 0 /dev/sda
ESS subsystem operating mode
To reduce the readahead overhead for the ESS, you can change the caching
algorithm. For example, our random OLTP database workload achieved best
results with the record caching algorithm. Follow the link
in the disk setup section to get more information on this topic.