在具有DMCRYPT / LVM / RAID1的Debian 6.0(AMD64)上写入性能非常低

我在其中一台服务器上看到了非常奇怪的性能特征。 此服务器正在运行简单的双磁盘软件-RAID1设置,LVM跨越/dev/md0 。 其中一个逻辑卷/dev/vg0/secure使用带有LUKS的dmcrypt进行encryption,并使用syncnoatimes标志进行挂载。 写入该卷的速度非常慢,速度为1.8 MB / s,CPU使用率接近0%。 有8个crpyto/1-8进程正在运行(这是一个Intel Quadcore CPU)。

我希望serverfault上的某个人在之前看过这个:-(。

uname -a

 2.6.32-5-xen-amd64 #1 SMP Tue Mar 8 00:01:30 UTC 2011 x86_64 GNU/Linux 

有趣的是,当我从设备上读取我获得良好的性能数字:

没有encryption的阅读:

 $ dd if=/dev/vg0/secure of=/dev/null bs=64k count=100000 100000+0 records in 100000+0 records out 6553600000 bytes (6.6 GB) copied, 68.8951 s, 95.1 MB/s 

读取encryption:

 $ dd if=/dev/mapper/secure of=/dev/null bs=64k count=100000 100000+0 records in 100000+0 records out 6553600000 bytes (6.6 GB) copied, 69.7116 s, 94.0 MB/s 

但是,当我尝试写入设备时:

 $ dd if=/dev/zero of=./test bs=64k 8809+0 records in 8809+0 records out 577306624 bytes (577 MB) copied, 321.861 s, 1.8 MB/s 

此外,当我读取我看CPU使用率,当我写,CPU保持几乎0%的使用率。 这里是cryptsetup luksDump输出:

 LUKS header information for /dev/vg0/secure Version: 1 Cipher name: aes Cipher mode: cbc-essiv:sha256 Hash spec: sha1 Payload offset: 2056 MK bits: 256 MK digest: dd 62 b9 a5 bf 6c ec 23 36 22 92 4c 39 f8 d6 5d c1 3a b7 37 MK salt: cc 2e b3 d9 fb e3 86 a1 bb ab eb 9d 65 df b3 dd d9 6b f4 49 de 8f 85 7d 3b 1c 90 83 5d b2 87 e2 MK iterations: 44500 UUID: a7c9af61-d9f0-4d3f-b422-dddf16250c33 Key Slot 0: ENABLED Iterations: 178282 Salt: 60 24 cb be 5c 51 9f b4 85 64 3d f8 07 22 54 d4 1a 5f 4c bc 4b 82 76 48 d8 a2 d2 6a ee 13 d7 5d Key material offset: 8 AF stripes: 4000 Key Slot 1: DISABLED Key Slot 2: DISABLED Key Slot 3: DISABLED Key Slot 4: DISABLED Key Slot 5: DISABLED Key Slot 6: DISABLED Key Slot 7: DISABLED 

也许你正在使用512字节以上的扇区(比如4K)的新硬盘? 如果是,你肯定应该关心磁盘路线。 为了进一步阅读,请查看以下描述该问题的链接:

http://bartsjerps.wordpress.com/2011/02/22/disk-alignment-linux/

http://tannerjc.net/wiki/index.php?title=Disk_Alignment

谢谢