我有两个硬件configuration完全相同的盒子。 两个SATA磁盘都有RAID0(使用mdadm创build)。 但在使用hdparm命令进行testing时,我获得了不同的caching读取。
$ hdparm -tT /dev/sda /dev/sda: Timing cached reads: 924 MB in 2.00 seconds = 462.20 MB/sec Timing buffered disk reads: 290 MB in 3.04 seconds = 95.44 MB/sec
而在另一个盒子上,
$ hdparm -tT /dev/sda /dev/sda: Timing cached reads: 18404 MB in 2.00 seconds = 9201.42 MB/sec Timing buffered disk reads: 322 MB in 3.00 seconds = 107.18 MB/sec
有人可以帮我解决这个问题。 为什么我在一台服务器上获得低caching读取? 有没有任何BIOS设置处理这个?
编辑1:
我试过两台机器上的perf工具。
问题即将到来的框中输出:
# perf stat dd if=/dev/zero of=/dev/null count=1000000 1000000+0 records in 1000000+0 records out 512000000 bytes (512 MB) copied, 6.22039 s, 82.3 MB/s Performance counter stats for 'dd if=/dev/zero of=/dev/null count=1000000': 5692.357502 task-clock-msecs # 0.913 CPUs 72 context-switches # 0.000 M/sec 7 CPU-migrations # 0.000 M/sec 220 page-faults # 0.000 M/sec 975469183 cycles # 171.365 M/sec 1374701843 instructions # 1.409 IPC 65350 cache-references # 0.011 M/sec 17986 cache-misses # 0.003 M/sec
输出在另一个盒子上:
$ perf stat dd if=/dev/zero of=/dev/null count=1000000 1000000+0 records in 1000000+0 records out 512000000 bytes (512 MB) copied, 0.280017 s, 1.8 GB/s Performance counter stats for 'dd if=/dev/zero of=/dev/null count=1000000': 278.388839 task-clock-msecs # 0.994 CPUs 0 context-switches # 0.000 M/sec 0 CPU-migrations # 0.000 M/sec 220 page-faults # 0.001 M/sec 725024593 cycles # 2604.359 M/sec 1371073131 instructions # 1.891 IPC 15921 cache-references # 0.057 M/sec 1847 cache-misses # 0.007 M/sec
我不明白为什么有这么多的上下文切换和task-clock-msecs的值也很高。 有人可以帮助我进一步debugging。
编辑2:
我得到smartctl命令的以下输出:
# /usr/local/sbin/smartctl -i /dev/sda smartctl 6.2 2013-07-26 r3841 [x86_64-linux-2.6.32-5-amd64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: ST91000640NS Serial Number: 9XG40W61 LU WWN Device Id: 5 000c50 050920a25 Add. Product Id: DELL(tm) Firmware Version: AA09 User Capacity: 1,000,204,886,016 bytes [1.00 TB] Sector Size: 512 bytes logical/physical Rotation Rate: 7200 rpm Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s) Local Time is: Sun Sep 29 00:03:33 2013 IST SMART support is: Available - device has SMART capability. SMART support is: Enabled # /usr/local/sbin/smartctl -i /dev/sdb smartctl 6.2 2013-07-26 r3841 [x86_64-linux-2.6.32-5-amd64] (local build) Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org === START OF INFORMATION SECTION === Device Model: ST91000640NS Serial Number: 9XG41K1L LU WWN Device Id: 5 000c50 05093c434 Add. Product Id: DELL(tm) Firmware Version: AA09 User Capacity: 1,000,204,886,016 bytes [1.00 TB] Sector Size: 512 bytes logical/physical Rotation Rate: 7200 rpm Device is: Not in smartctl database [for details use: -P showall] ATA Version is: ATA8-ACS T13/1699-D revision 4 SATA Version is: SATA 3.0, 3.0 Gb/s (current: 3.0 Gb/s) Local Time is: Sun Sep 29 00:03:33 2013 IST SMART support is: Available - device has SMART capability. SMART support is: Enabled
磁盘读取数量在10%左右。 我不会担心这么小的差别。 (caching的读取不是磁盘I / O,与磁盘或I / O无关。请参阅hdparm手册页,了解为什么这是毫无意义的)。
我认为@DavidSchwartz在这里有正确的想法,显然这个问题是其他地方,因为磁盘速度看起来非常相似。
我见过的跟踪性能相关问题的最好资源是使用Brendan Gregg描述的USE方法 。 由于您使用的是Linux,所以他也有一个专门针对Linux的相关文章 。