The principle of file prefetching is to read a certain amount of adjacent data and cache them on the memory based on the locality principle during data read. If the prefetched data is the data to be used, the system performance is improved. If it is not, the drive bandwidth is wasted. In sequential drive read scenarios, increasing the value of this parameter will deliver a noticeable performance boost.
Procedure (CentOS is used as an example):
1. The file prefetching parameter is defined in the read_ahead_kb file. In CentOS, the read_ahead_kb file is stored in the /sys/block/$DEVICE-NAME/queue/ directory. If you do not know where it is, run the following command to query its path:
# find / -name read_ahead_kb
2. The default value of this parameter is 128 KB. Run the following command to change the value to 4096 KB:
# echo 4096 > /sys/block/$DEVICE-NAME /queue/read_ahead_kb
$DEVICE-NAME indicates the drive name.
