DragonflyBSDのGENERICにvirtioが入ったと聞いて早速ビルドして試してみたのだが、 残念ながらネットワークのvirtioサポートはまだらしい(そもそもソースがツ リーに含まれていない感じ)。 virtio_blk.koは存在して利用できるようなので、とりあえず書き込み性能だ け簡単に比較してみた。
ホスト
- Linux hachune.local 3.6.11-1-ARCH #1 SMP PREEMPT Tue Dec 18 08:57:15 CET 2012 x86_64 GNU/Linux
- QEMU emulator version 1.2.1, Copyright (c) 2003-2008 Fabrice Bellard
Virtioあり
QEMUの構成
qemu-system-x86_64 -enable-kvm -smp 2 -m 2048 \ -drive file=/dev/vg0/Dragonfly,if=virtio \ -net nic,model=virtio,macaddr=52:54:00:43:23:11 \ -net tap,ifname=tap0,script=/home/miku/kvm/ifup_br0.sh \ -serial pty \ -cdrom /home/miku/Image/dfly-x86_64-3.3-current.iso -boot d
HAMMER
29895208.6 bytes/sec
# newfs_hammer -L TEST /dev/vbd0s1b Volume 0 DEVICE /dev/vbd0s1b size 11.25GB initialize freemap volume 0 initializing the undo map (504 MB) --------------------------------------------- 1 volume total size 11.25GB version 6 boot-area-size: 32.00MB memory-log-size: 32.00MB undo-buffer-size: 504.00MB total-pre-allocated: 0.51GB fsid: 95359a72-5dc9-11e2-a6d0-e915af5f7f28 NOTE: Please remember that you may have to manually set up a cron(8) job to prune and reblock the filesystem regularly. By default, the system automatically runs 'hammer cleanup' on a nightly basis. The periodic.conf(5) variable 'daily_clean_hammer_enable' can be unset to disable this. Also see 'man hammer' and 'man HAMMER' for more information. WARNING: HAMMER filesystems less than 50GB are not recommended! You may have to run 'hammer prune-everything' and 'hammer reblock' quite often, even if using a nohistory mount. # mount_hammer /dev/vbd0s1b /mnt # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 37.101394 secs (28262442 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 32.183600 secs (32581066 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 38.717169 secs (27082972 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 34.504874 secs (30389214 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 33.650971 secs (31160349 bytes/sec)
UFS
51055029.6 bytes/sec
# newfs /dev/vbd0s1b
/dev/vbd0s1b: media size 11515.96MB
Warning: Block size and bytes per inode restrict cylinders per group to 89.
Warning: 80 sector(s) in last cylinder unallocated
/dev/vbd0s1b: 23584688 sectors in 5758 cylinders of 1 tracks, 4096 sectors
11516.0MB in 65 cyl groups (89 c/g, 178.00MB/g, 22400 i/g)
super-block backups (for fsck -b #) at:
32, 364576, 729120, 1093664, 1458208, 1822752, 2187296, 2551840, 2916384,
3280928, 3645472, 4010016, 4374560, 4739104, 5103648, 5468192, 5832736,
6197280, 6561824, 6926368, 7290912, 7655456, 8020000, 8384544, 8749088,
9113632, 9478176, 9842720, 10207264, 10571808, 10936352, 11300896, 11665440,
12029984, 12394528, 12759072, 13123616, 13488160, 13852704, 14217248,
14581792, 14946336, 15310880, 15675424, 16039968, 16404512, 16769056,
17133600, 17498144, 17862688, 18227232, 18591776, 18956320, 19320864,
19685408, 20049952, 20414496, 20779040, 21143584, 21508128, 21872672,
22237216, 22601760, 22966304, 23330848
# mount_ufs /dev/vbd0s1b /mnt
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 19.852371 secs (52818678 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 19.631861 secs (53411951 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 21.491887 secs (48789388 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 22.926797 secs (45735826 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 19.233114 secs (54519305 bytes/sec)
Virtioなし
QEMUの構成
qemu-system-x86_64 -enable-kvm -smp 2 -m 2048 \ -hda /dev/vg0/Dragonfly \ -net nic,model=e1000,macaddr=52:54:00:43:23:11 \ -net tap,ifname=tap0,script=/home/miku/kvm/ifup_br0.sh \ -serial pty \ -cdrom /home/miku/Image/dfly-x86_64-3.3-current.iso -boot d
HAMMER
17620950.4 bytes/sec
# newfs_hammer -L TEST /dev/ad1s1b Volume 0 DEVICE /dev/ad1s1b size 11.25GB initialize freemap volume 0 initializing the undo map (504 MB) --------------------------------------------- 1 volume total size 11.25GB version 6 boot-area-size: 32.00MB memory-log-size: 32.00MB undo-buffer-size: 504.00MB total-pre-allocated: 0.51GB fsid: ff28dca3-5dcb-11e2-b2ce-535400432311 NOTE: Please remember that you may have to manually set up a cron(8) job to prune and reblock the filesystem regularly. By default, the system automatically runs 'hammer cleanup' on a nightly basis. The periodic.conf(5) variable 'daily_clean_hammer_enable' can be unset to disable this. Also see 'man hammer' and 'man HAMMER' for more information. WARNING: HAMMER filesystems less than 50GB are not recommended! You may have to run 'hammer prune-everything' and 'hammer reblock' quite often, even if using a nohistory mount. # mount_hammer /dev/ad1s1b /mnt # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 59.103703 secs (17741291 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 57.336238 secs (18288190 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 57.117314 secs (18358286 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 62.101431 secs (16884893 bytes/sec) # dd if=/dev/zero of=/mnt/test.img bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes transferred in 62.296237 secs (16832092 bytes/sec)
UFS
28662327.0 bytes/sec
# newfs /dev/ad1s1b
/dev/ad1s1b: media size 11515.96MB
Warning: Block size and bytes per inode restrict cylinders per group to 89.
Warning: 80 sector(s) in last cylinder unallocated
/dev/ad1s1b: 23584688 sectors in 5758 cylinders of 1 tracks, 4096 sectors
11516.0MB in 65 cyl groups (89 c/g, 178.00MB/g, 22400 i/g)
super-block backups (for fsck -b #) at:
32, 364576, 729120, 1093664, 1458208, 1822752, 2187296, 2551840, 2916384,
3280928, 3645472, 4010016, 4374560, 4739104, 5103648, 5468192, 5832736,
6197280, 6561824, 6926368, 7290912, 7655456, 8020000, 8384544, 8749088,
9113632, 9478176, 9842720, 10207264, 10571808, 10936352, 11300896, 11665440,
12029984, 12394528, 12759072, 13123616, 13488160, 13852704, 14217248,
14581792, 14946336, 15310880, 15675424, 16039968, 16404512, 16769056,
17133600, 17498144, 17862688, 18227232, 18591776, 18956320, 19320864,
19685408, 20049952, 20414496, 20779040, 21143584, 21508128, 21872672,
22237216, 22601760, 22966304, 23330848
# mount_ufs /dev/ad1s1b /mnt
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 37.872868 secs (27686733 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 38.206654 secs (27444853 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 32.039132 secs (32727978 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 40.281541 secs (26031179 bytes/sec)
# dd if=/dev/zero of=/mnt/test.img bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 35.640524 secs (29420892 bytes/sec)
結果
virtioを利用した場合のほうが書き込み性能は2倍近く高くなることが分かっ た。読み込みは測るのをうっかり忘れてて途中で気が付いた。
| HAMMER(virtio) | HAMMER | UFS(virtio) | UFS | |
|---|---|---|---|---|
| 1 | 28262442 | 17741291 | 52818678 | 27686733 |
| 2 | 32581066 | 18288190 | 53411951 | 27444853 |
| 3 | 27082972 | 18358286 | 48789388 | 32727978 |
| 4 | 30389214 | 16884893 | 45735826 | 26031179 |
| 5 | 31160349 | 16832092 | 54519305 | 29420892 |
| 平均 | 29895209 | 17620950 | 51055030 | 28662327 |
おまけのdmesg
# dmesg
Copyright (c) 2003-2013 The DragonFly Project.
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
DragonFly v3.3.0.942.gfa75bf-DEVELOPMENT #0: Mon Jan 14 04:04:37 JST 2013
root@vy1.hachune.local:/usr/obj/usr/src/sys/X86_64_GENERIC
TSC clock: 1646507109 Hz, i8254 clock: 1193192 Hz
CPU: QEMU Virtual CPU version 1.2.1 (1646.52-MHz K8-class CPU)
Origin = "AuthenticAMD" Id = 0x623 Stepping = 3
Features=0x783fbfd<FPU,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2>
Features2=0x80802001<SSE3,CX16,POPCNT,VMM>
AMD Features=0x20100800<SYSCALL,NX,LM>
AMD Features2=0x65<LAHF,SVM,ABM,SSE4A>
real memory = 2147081216 (2047 MB)
avail memory = 1964879872 (1873 MB)
lapic: divisor index 0, frequency 500010320 Hz
Initialize MI interrupts
FQ scheduler policy version 1.1 loaded
wdog: In-kernel automatic watchdog reset enabled
kbd1 at kbdmux0
disk scheduler: set policy of md0 to noop
md0: Malloc disk
ACPI: RSDP 0xfd950 00014 (v00 BOCHS )
ACPI: RSDT 0x7fffe3d0 00038 (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
ACPI: FACP 0x7fffff80 00074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
ACPI: DSDT 0x7fffe410 0124A (v01 BXPC BXDSDT 00000001 INTL 20121018)
ACPI: FACS 0x7fffff40 00040
ACPI: SSDT 0x7ffffe30 00110 (v01 BOCHS BXPCSSDT 00000001 BXPC 00000001)
ACPI: APIC 0x7ffffd10 00080 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
ACPI: HPET 0x7ffffcd0 00038 (v01 BOCHS BXPCHPET 00000001 BXPC 00000001)
ACPI: SSDT 0x7ffff660 0066E (v01 BXPC BXSSDTPC 00000001 INTL 20121018)
cryptosoft0: <software crypto> on motherboard
acpi0: <BOCHS BXPCRSDT> on motherboard
ACPI FADT: SCI testing interrupt mode ...
ACPI FADT: SCI select level/low
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
objcache_reclaimlist
acpi0: Power Button (fixed)
Warning: ACPI is disabling APM's device. You can't run both
acpi_timer0: <24-bit timer at 3.579545MHz> port 0xb008-0xb00b on acpi0
acpi_hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
acpi_hpet0: frequency 100000000
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci_link4: Unable to route IRQs: AE_NOT_FOUND
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX3 WDMA2 controller> port 0xc060-0xc06f,0x376,0x170-0x177,0x3f6,0x1f0-0x1f7 at device 1.1 on pci0
ata0: <ATA channel 0> on atapci0
ata1: <ATA channel 1> on atapci0
disk scheduler: set policy of acd0 to noop
acd0: DVDROM <QEMU DVD-ROM/1.2.1> at ata1-master WDMA2
pci0: <bridge> (vendor 0x8086, dev 0x7113) at device 1.3 irq 9
vgapci0: <VGA-compatible display> mem 0xfebf0000-0xfebf0fff,0xfc000000-0xfdffffff at device 2.0 on pci0
virtio_pci0: <VirtIO PCI Network adapter> port 0xc040-0xc05f mem 0xfebf1000-0xfebf1fff irq 11 at device 3.0 on pci0
virtio_pci1: <VirtIO PCI Block adapter> port 0xc000-0xc03f mem 0xfebf2000-0xfebf2fff irq 11 at device 4.0 on pci0
virtio_pci1: host features: 0x710006d4 <EventIdx,0x10000000,NotifyOnEmpty,Topology,FlushCmd,SCSICmds,BlockSize,DiskGeometry,MaxNumSegs>
virtio_pci1: negotiated features: 0x254 <FlushCmd,BlockSize,DiskGeometry,MaxNumSegs>
disk scheduler: set policy of vbd0 to noop
atkbdc0: <Keyboard controller (i8042)> port 0x64,0x60 irq 1 on acpi0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model IntelliMouse Explorer, device ID 4
cpu0: <ACPI CPU> on acpi0
cpu_cst0: <ACPI CPU C-State> on cpu0
cpu1: <ACPI CPU> on acpi0
cpu_cst1: <ACPI CPU C-State> on cpu1
orm0: <Option ROM> at iomem 0xed000-0xeffff on isa0
pmtimer0 on isa0
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1: can't drain, serial port might not exist, disabling
ppc0: cannot reserve I/O port range
hpt27xx: no controller detected.
CAM: Configuring 2 busses
CAM: finished configuring all busses
disk scheduler: set policy of cd0 to noop
no B_DEVMAGIC (bootdev=0)
Device Mapper version 4.16.0 loaded
dm_target_error: Successfully initialized
dm_target_zero: Successfully initialized
cd0 at ata1 bus 0 target 0 lun 0
cd0: <QEMU QEMU DVD-ROM 1.2.> Removable CD-ROM SCSI-0 device
cd0: 16.000MB/s transfers
cd0: cd present [347187 x 2048 byte records]
Mounting root from cd9660:cd0
DMA space used: 152k, remaining available: 16384k
Mounting devfs
0 件のコメント:
コメントを投稿