Disk Read-Ahead in Linux

原文地址: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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值