使用DMCRYPT / LVM / RAID1在Debian 6.0(AMD64)上写入性能非常慢

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

我希望有人在服务器故障之前看过这个:-(.

uname -a

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

有趣的是,当我从设备上读到时,我得到了很好的性能数字:

没有加密的阅读:

$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

加密阅读:

$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

谢谢

相关文章

/etc/sysctl.conf这个目录主要是配置一些系统信息,/etc/sys...
1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起...
它们都是多模式编辑器,不同的是vim 是vi的升级版本,它不仅...
不管是我们在安装软件还是监测软件的使用性能,我们都要随时...
装好Tomcat7后,发现除了本机能访问外界访问不了,岂有此理。...
修改防火墙配置需要修改 /etc/sysconfig/iptables 这个文件,...