[Linux] 使用noatime属性优化文件系统读取性能

博客原文:
**hackershell**

当文件被创建,修改和访问时,Linux系统会记录这些时间信息,当访问足够频繁将会是很大的开销,因为每次访问都会记录时间,所以 我们今天使用bonnie++来简单测试我们修改noatime给我们带来的性能提升有多少,我们先下载最新版本的bonnie++

# tar xf bonnie++-1.97.tgz
# cd bonnie++-1.97.1
# make

编译好之后就可以使用了

注:测试数据最好为内存的2倍

所以在没修改noatime之前,我们先测试文件系统的性能

./bonnie++ -s 31896 -d /export/ -u root -q >> file.csv

运行结果如下:

Version  1.97       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
localhost    31896M   458  99 189663  52 82909  21  2487  98 214994  26 823.4  56
Latency             32591us     566ms     705ms   11924us     252ms     122ms
Version  1.97       ------Sequential Create------ --------Random Create--------
localhost           -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 16300  79 +++++ +++ +++++ +++ 14745  74 +++++ +++ 18007  32
Latency             10929us     478us     521us     493us     134us     374us

接下来我们修改挂载的/export,重新测试一遍

# vim /etc/fstab
UUID=d41182b5-5092-4f2f-88a3-be619feef512 /export                 ext4    defaults,noatime        1 2

设置立即生效

mount -o remount /export

执行命令:

./bonnie++ -s 31896 -d /export/ -u root -q >> file.csv

运行结果为:

Version  1.97       ------Sequential Output------ --Sequential Input- --Random-
Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
localhost    31896M   497  99 171760  35 93152  21  2276  97 240294  28 755.6  45
Latency             18716us     661ms     539ms   29368us     263ms   79468us
Version  1.97       ------Sequential Create------ --------Random Create--------
localhost           -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                 16 18605  93 +++++ +++ +++++ +++ 20520  96 +++++ +++ +++++ +++
Latency              1186us     379us    1297us    1288us     127us    1443us

可能这样的结果不直观,我们可以

cat file.csv | ./bon_csv2html > result.html

网页打开为:

<img src="http://hackershell.cn/image/noatime2.png&quot; alt="noatime_test1" align=center />

可以看出214MBps提升到了240MBps,虽然这只是一次测试,但是理论上来说还是会有性能上的提升,在整体的集群环境下,还是有益提升集群性能的。

参考资料:

测试工具Bonnie++的使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值