ext4 dd 性能测试中的奇怪行为

ext4 dd 性能测试中的奇怪行为

我正在 raid1 系统上测试 ext3/ext4 的性能(但非 raid 系统也是如此)。bonnie++ 的结果给出了扭曲的图像,因为它们绕过了 ext4 上的延迟分配。所以我想用 dd 测试性能。

dd bs=20M count=1024 if=/dev/zero of=/mountpoint/test conv=fdatasync

这些是在 ext4 上进行一系列 dd 运行的结果:

21474836480 bytes (21 GB) copied, 177.162 s, 121 MB/s
21474836480 bytes (21 GB) copied, 181.148 s, 119 MB/s
21474836480 bytes (21 GB) copied, 181.873 s, 118 MB/s
21474836480 bytes (21 GB) copied, 183.865 s, 117 MB/s
21474836480 bytes (21 GB) copied, 189.333 s, 113 MB/s
21474836480 bytes (21 GB) copied, 190.711 s, 113 MB/s
21474836480 bytes (21 GB) copied, 195.004 s, 110 MB/s
21474836480 bytes (21 GB) copied, 197.961 s, 108 MB/s
21474836480 bytes (21 GB) copied, 202.645 s, 106 MB/s
21474836480 bytes (21 GB) copied, 204.505 s, 105 MB/s
21474836480 bytes (21 GB) copied, 210.022 s, 102 MB/s
21474836480 bytes (21 GB) copied, 215.073 s, 99.8 MB/s
21474836480 bytes (21 GB) copied, 221.405 s, 97.0 MB/s
21474836480 bytes (21 GB) copied, 226.552 s, 94.8 MB/s
21474836480 bytes (21 GB) copied, 236.038 s, 91.0 MB/s
21474836480 bytes (21 GB) copied, 242.735 s, 88.5 MB/s
21474836480 bytes (21 GB) copied, 252.866 s, 84.9 MB/s
21474836480 bytes (21 GB) copied, 263.934 s, 81.4 MB/s
21474836480 bytes (21 GB) copied, 277.89 s, 77.3 MB/s
21474836480 bytes (21 GB) copied, 295.957 s, 72.6 MB/s
21474836480 bytes (21 GB) copied, 320.406 s, 67.0 MB/s
21474836480 bytes (21 GB) copied, 310.082 s, 69.3 MB/s
21474836480 bytes (21 GB) copied, 180.104 s, 119 MB/s
21474836480 bytes (21 GB) copied, 178.806 s, 120 MB/s
21474836480 bytes (21 GB) copied, 184.888 s, 116 MB/s
21474836480 bytes (21 GB) copied, 184.223 s, 117 MB/s
21474836480 bytes (21 GB) copied, 189.156 s, 114 MB/s
21474836480 bytes (21 GB) copied, 191.854 s, 112 MB/s
21474836480 bytes (21 GB) copied, 195.005 s, 110 MB/s
21474836480 bytes (21 GB) copied, 199.11 s, 108 MB/s
21474836480 bytes (21 GB) copied, 203.337 s, 106 MB/s
21474836480 bytes (21 GB) copied, 206.47 s, 104 MB/s
21474836480 bytes (21 GB) copied, 211.136 s, 102 MB/s
21474836480 bytes (21 GB) copied, 216.129 s, 99.4 MB/s
21474836480 bytes (21 GB) copied, 221.425 s, 97.0 MB/s
21474836480 bytes (21 GB) copied, 228.962 s, 93.8 MB/s
21474836480 bytes (21 GB) copied, 238.214 s, 90.1 MB/s
21474836480 bytes (21 GB) copied, 245.252 s, 87.6 MB/s
21474836480 bytes (21 GB) copied, 254.058 s, 84.5 MB/s
21474836480 bytes (21 GB) copied, 267.616 s, 80.2 MB/s
21474836480 bytes (21 GB) copied, 282.603 s, 76.0 MB/s
21474836480 bytes (21 GB) copied, 298.554 s, 71.9 MB/s
21474836480 bytes (21 GB) copied, 322.213 s, 66.6 MB/s
21474836480 bytes (21 GB) copied, 282.227 s, 76.1 MB/s
21474836480 bytes (21 GB) copied, 179.186 s, 120 MB/s
21474836480 bytes (21 GB) copied, 180.16 s, 119 MB/s
21474836480 bytes (21 GB) copied, 185.174 s, 116 MB/s
21474836480 bytes (21 GB) copied, 184.693 s, 116 MB/s
21474836480 bytes (21 GB) copied, 188.318 s, 114 MB/s
21474836480 bytes (21 GB) copied, 192.305 s, 112 MB/s
21474836480 bytes (21 GB) copied, 195.372 s, 110 MB/s
21474836480 bytes (21 GB) copied, 200.711 s, 107 MB/s
21474836480 bytes (21 GB) copied, 204.003 s, 105 MB/s
21474836480 bytes (21 GB) copied, 206.468 s, 104 MB/s
21474836480 bytes (21 GB) copied, 213.033 s, 101 MB/s
21474836480 bytes (21 GB) copied, 217.02 s, 99.0 MB/s
21474836480 bytes (21 GB) copied, 222.62 s, 96.5 MB/s
21474836480 bytes (21 GB) copied, 227.523 s, 94.4 MB/s

如您所见,性能一开始符合预期,约为 120MB/s,但下降到 65MB/s 左右,然后又跳回到 120MB/s,依此类推......

目前,我完全不知道这些奇怪结果的原因。我的 ext3 测试结果符合预期(都在 100MB/s 左右)。有人能告诉我吗?

以下是更多系统规格:

mdadm controlled raid1
ext4 with default options (mkfs.ext4 /dev/sdb1)
mounted with default options (mount /dev/sdb1 /mountpoint)
disks: WD5003ABYX
os: custom debian kernel 2.6.36 x86

答案1

添加oflag=directoflag=direct,sync查看是否获得更一致的结果。

我猜你稍微超过了平均持续写入速率,然后它开始变慢。一段时间后,你可能会遇到一些内存不足的情况,这可以解释为什么你的有效带宽减半。请参阅以下几点以了解一些注意事项:https://unix.stackexchange.com/questions/30286/can-i-configure-my-linux-system-for-more-aggressive-file-system-cachinghttps://stackoverflow.com/questions/3019748/how-to-reliably-measure-available-memory-in-linux/3031924#3031924

确保您在空闲系统上工作(使用top和检查iotop),您应该会看到高等待写作时。

如果可以的话,提高 I/O 优先级也会有帮助:ionice -c1 dd [...]

检查您是否启用了任何省电功能。这是一个有用的资源:http://www.noah.org/wiki/Benchmarks

相关内容