我有Ubuntu 12.04主机运行Linux 3.2.0-24-generic,libvirt 0.9.8-2ubuntu17,qemu-kvm 1.0 + noroms-0ubuntu13。 主持人使用电梯=截止时间,客人使用电梯= noop。 所有KVM guest虚拟机都使用virtio,no caching,io mode default和LVM逻辑卷作为存储。 我使用bonnie ++ 1.96来评估IO性能。
硬件:
硬盘分区如下:
Fdisk输出:
# fdisk -b 4096 /dev/sda Note: sector size is 4096 (not 512) Command (m for help): p Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 15200 cylinders, total 244190646 sectors Units = sectors of 1 * 4096 = 4096 bytes Sector size (logical/physical): 4096 bytes / 4096 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 * 2048 39070000 156271812 fd Linux raid autodetect /dev/sda2 39070080 1297361280 738197508 fd Linux raid autodetect /dev/sda3 1297361288 1945712472 2593404740 fd Linux raid autodetect /dev/sda4 1945712480 1953525160 31250724 82 Linux swap / Solaris
观察:
输出:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP hostname 2G 1132 91 21439 1 21741 2 5131 86 +++++ +++ 1747 8 Latency 10093us 459ms 128us 3928us 113us 83us Version 1.96 ------Sequential Create------ --------Random Create-------- hostname -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 23851 19 +++++ +++ 28728 17 28138 21 +++++ +++ 31239 19 Latency 1017us 602us 1144us 323us 61us 1196us
输出:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP hostname 2G 965 88 9244 0 7981 1 2595 74 54185 4 248.4 4 Latency 16439us 13832ms 4195ms 126ms 280ms 236ms Version 1.96 ------Sequential Create------ --------Random Create-------- hostname -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 4433 5 +++++ +++ 8005 4 8373 8 +++++ +++ 7325 4 Latency 101ms 1003us 494us 298us 64us 419us
输出:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP hostname 2G 1019 93 16786 2 12406 2 1747 30 39973 2 659.2 6 Latency 18226us 7968ms 2617ms 445ms 212ms 1613ms Version 1.96 ------Sequential Create------ --------Random Create-------- hostname -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ 16709 14 Latency 28112us 440us 442us 166us 96us 123us
问题:
这听起来像4k块alignment问题。 你用fdisk的-b选项吗?