Centos 6 vs Centos 7文件访问性能

我想找一些帮助来弄清楚什么可以解释为什么Centos 7在访问文件,然后是Centos 6比较慢。这大概有17%的差异。

这是一个简单的testing:

[root@test-centos6 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m42.283s user 0m2.465s sys 0m4.434s [root@test-centos6 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m41.890s user 0m2.442s sys 0m4.341s [root@test-centos6 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m41.795s user 0m2.383s sys 0m4.310s ---- [root@test-centos7 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m49.081s user 0m16.306s sys 0m32.639s [root@test-centos7 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m48.379s user 0m16.034s sys 0m32.191s [root@test-centos7 shm]# time for i in $(seq 0 50000); do stat file > /dev/null; done real 0m48.054s user 0m15.680s sys 0m32.245s 

strace似乎确认C7执行更多的操作每个数据然后C6。

 [root@test-centos6 shm]# strace stat file 2>&1 | wc -l 145 [root@test-centos7 shm]# strace stat file 2>&1 | wc -l 168 

任何人都知道如何减lessC7操作的数量,所以perfs更符合C6?

谢谢,

//编辑:

我已经把/ dev / shm放在了一个可能的xfs / ext4区别。 在同一个ESX主机上有两个相同的虚拟机,只有一个不同的操作系统。 (但是我在硬件盒上也观察到了相同的差异,只是把这些虚拟机用于当前的testing)

Strace C6: https: //paste.fedoraproject.org/paste/oCSUZqKgcoNLJubjeNbo9V5M1UNdIGYhyRLivL9gydE= Strace C7: https ://paste.fedoraproject.org/paste/PvTXvxxvS~2UZ9LuuSVAA15M1UNdIGYhyRLivL9gydE=

我会假设新的C7在股票forms上会有更好的performance,而不是更糟。

 [root@test-centos6 shm]# uname -r 2.6.32-642.el6.x86_64 [root@test-centos6 shm]# getenforce Disabled [root@test-centos7 shm]# uname -r 3.10.0-514.6.1.el7.x86_64 [root@test-centos7 shm]# getenforce Disabled 

它们是完全不同的操作系统,具有不同的内核,编译默认值,文件系统,调度程序和调优function。

你为什么认为他们应该相同? 有很多要说明的,所以这个问题很难以现在的forms来回答。

stat实用程序在CentOS6和CentOS7上有所不同。 要确认,请尝试在两台机器上发布stat --version

新的strace版本可能更复杂。 例如,从你的strace输出看来,CentOS7的strace映射了libpcre.so.1 (一个libpcre.so.1expression式库),而CentOS6的strace没有。

无论如何,这基本上是一个jar头testing:真正的文件访问/操作速度的基准,你应该使用工具作为fs_mark ,甚至更好,一些真实世界的testing(例如:解压一个大的档案)。