原文地址:http://linuxmantra.com/2013/11/disk-read-ahead-in-linux.html
We know that Input Output process on disk is always a time consuming process. A number of ideas has been applied to improve I/O performance on disk and Read-Ahead is of the those ideas.
Read-Ahead speeds up file access (Read operation on disk) by pre-fetching data and loading it into RAM. The assumption is that in sequential access pre-fetching will reduce time to perform complete operation. The advantage of Read-Ahead is that the next data available if RAM before transfer request raised for same. Remember that Read-Ahead could only be useful for sequential access, for random access this feature will not be used. Linux kernel are smart enough to detect that if the request is sequential or random.
How many sectors will be Read-Ahead for sequential access ?
On RHEL 6.x and CentOS 6.x, you can issue following command to get that setting
#blockdev — getra /dev/sda
(here getra is get Read-Ahead, /dev/sda is the disk )
By default Read-Ahead value will be 256 sector.
If you want value in KB then look into /sys/block/
#cat /sys/block/sda/queue/read_ahead_kb
Here the output should be 128, as we know (2 Sector=2×1024=1KB)
If you want to update Read-Ahead value with new one, use –setra option with blockdev command
#blockdev — setra 512 /dev/sda
本文介绍了Linux系统中磁盘预读(Read-Ahead)机制的工作原理及其如何通过预取数据到RAM来加速文件访问过程。针对连续访问场景,预读能够显著减少完成操作所需的时间。文章还详细说明了如何在RHEL6.x和CentOS6.x系统上查看和调整预读设置。

924

被折叠的 条评论
为什么被折叠?



