This article is too interesting!
Lookahead
If the required data is read synchronously every time a user requests it, it takes a long time to wait for disk I/O. Therefore, the cache is enriched by pre-reading the subsequent blocks that are not requested when the I/O request is determined to be a sequential read. Look-ahead data may be used or wasted. Check the operation to see how efficient it is by pre-reading.
https://www.kimullaa.com/entry/2019/12/01/130347
#//Make sure look-ahead is enabled
cat /sys/block/sda/queue/read_ahead_kb
#cache deleted
echo 3 > /proc/sys/vm/drop_caches
#(With look-ahead)Read speed measurement
time dd if=/dev/sda of=/dev/null bs=10M count=100
#Disable look-ahead
echo 0 > /sys/block/sda/queue/read_ahead_kb
#cache deleted
echo 3 > /proc/sys/vm/drop_caches
#(No look-ahead) Read speed measurement
time dd if=/dev/sda of=/dev/null bs=10M count=100
result
[root@localhost test]# cat /sys/block/sda/queue/read_ahead_kb
4096
[root@localhost test]# echo 3 > /proc/sys/vm/drop_caches
[root@localhost test]# time dd if=/dev/sda of=/dev/null bs=10M count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB) copied, 1.53053 s, 685 MB/s
real 0m1.566s
user 0m0.000s
sys 0m1.074s
[root@localhost test]# #Disable look-ahead
[root@localhost test]# echo 0 > /sys/block/sda/queue/read_ahead_kb
[root@localhost test]# echo 3 > /proc/sys/vm/drop_caches
[root@localhost test]# time dd if=/dev/sda of=/dev/null bs=10M count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB) copied, 37.3734 s, 28.1 MB/s
real 0m37.386s
user 0m0.001s
sys 0m25.442s
[root@localhost test]#