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

博客原文:
**hackershell**html

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

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

编译好以后就能够使用了vim

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

因此在没修改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

设置当即生效.net

mount -o remount /export

执行命令:code

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

运行结果为:htm

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++的使用

相关文章
相关标签/搜索