最新消息:

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

noatime admin 3530浏览 0评论

当文件被创建,修改和访问时,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

网页打开为:

noatime2

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

参考资料:

测试工具Bonnie++的使用

转载请注明:爱开源 » 使用noatime属性优化文件系统读取性能

您必须 登录 才能发表评论!