お名前.comのVPS(メモリ4GBプラン)をmikutterユーザ会として1年間無償で借りることができたので、 早速いろいろ試してみた。
今回はVPS上で「コミュニティーでいろいろ共用できるサーバ」にするので、コンテナ型の仮想化が一番 よさそうと考え、とりあえずFreeBSDを導入することにした。ただ、 FreeBSD9.1-RC1の時点ではまだvirtioが利用できないため、 virtioがbaseのGENERICに入った9-STABLEをビルドし導入する。
今回テストしたバージョンは以下の通り。
FreeBSD 9.1-PRERELEASE #0 r241139: Wed Oct 3 04:26:52 JST 2012
CentOS 6.2(linux-2.6.32, virtio) dd if=/dev/zero of=test.img bs=1M count=1000 1048576000 bytes (1.0 GB) copied, 3.63471 s, 288 MB/s
FreeBSD 9-stable(not virtio) % dd if=/dev/zero of=test.img bs=1M count=1000 1048576000 bytes transferred in 7.655223 secs (136975241 bytes/sec)
FreeBSD 9-stable(virtio) % dd if=/dev/zero of=test.img bs=1M count=1000 1048576000 bytes transferred in 3.158812 secs (331952641 bytes/sec)
ホストは共用なので細かい速度はあてにならないかもしれないが、 virtioを有効にしたFreeBSDはそれなりに速度が出ている模様。やはりvirtio無しは遅い。 CentOSは何度か試したところ、試したタイミングが悪かった可能性があるのでなんとも言えないものの、 速度にFreeBSDより大きなばらつきがあった。
試しに安鯖で有名なML110G7でも同様の処理をしてみた。
FreeBSD 9-stable(ML110G7) % dd if=/dev/zero of=test.img bs=1M count=1000 1048576000 bytes transferred in 11.833178 secs (88613221 bytes/sec)
VPSのほうがDisk I/Oは圧倒的に速いようだ。かなしい。
dmesgは以下の通り。
Copyright (c) 1992-2012 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.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.1-PRERELEASE #0 r241139: Wed Oct 3 04:26:52 JST 2012
root@vps.m.hachune.net:/usr/obj/usr/src/sys/GENERIC amd64
CPU: Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz (2533.48-MHz K8-class CPU)
Origin = "GenuineIntel" Id = 0x6fb Family = 0x6 Model = 0xf Stepping = 11
Features=0xf8bf3ff
Features2=0x80002201
AMD Features=0x20100800
AMD Features2=0x1
TSC: P-state invariant
real memory = 4294967296 (4096 MB)
avail memory = 4101722112 (3911 MB)
Event timer "LAPIC" quality 400
ACPI APIC Table:
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 4 package(s) x 1 core(s)
cpu0 (BSP): APIC ID: 0
cpu1 (AP): APIC ID: 1
cpu2 (AP): APIC ID: 2
cpu3 (AP): APIC ID: 3
ioapic0: Changing APIC ID to 4
ioapic0 irqs 0-23 on motherboard
kbd1 at kbdmux0
acpi0: on motherboard
acpi0: Power Button (fixed)
cpu0: on acpi0
cpu1: on acpi0
cpu2: on acpi0
cpu3: on acpi0
atrtc0: port 0x70-0x71,0x72-0x77 irq 8 on acpi0
Event timer "RTC" frequency 32768 Hz quality 0
hpet0: iomem 0xfed00000-0xfed003ff on acpi0 [46/403]
Timecounter "HPET" frequency 100000000 Hz quality 950
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0xb008-0xb00b on acpi0
pcib0: port 0xcf8-0xcff on acpi0
pci0: on pcib0
pci_link4: Unable to route IRQs: AE_NOT_FOUND
isab0: at device 1.0 on pci0
isa0: on isab0
atapci0: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xc000-0xc00f at device 1.1 on pci0
ata0: at channel 0 on atapci0
ata1: at channel 1 on atapci0
uhci0: port 0xc020-0xc03f irq 11 at device 1.2 on pci0
usbus0: controller did not stop
usbus0 on uhci0
pci0: at device 1.3 (no driver attached)
vgapci0: mem 0xf0000000-0xf1ffffff,0xf2000000-0xf2000fff at device 2.0 on pci0
virtio_pci0: port 0xc040-0xc05f mem 0xf2020000-0xf2020fff irq 11 at device 3.0 on pci0
vtnet0: on virtio_pci0
virtio_pci0: host features: 0x711fffe3
virtio_pci0: negotiated features: 0x110fbba3
vtnet0: Ethernet address: 02:16:3e:68:9f:e5
virtio_pci1: port 0xc080-0xc0bf mem 0xf2040000-0xf2040fff irq 11 at device 4.0 on pci0
vtblk0: on virtio_pci1
virtio_pci1: host features: 0x710006d4
virtio_pci1: negotiated features: 0x10000254
vtblk0: 81920MB (167772160 512 byte sectors)
virtio_pci2: port 0xc0c0-0xc0ff mem 0xf2041000-0xf2041fff irq 10 at device 5.0 on pci0
vtblk1: on virtio_pci2
virtio_pci2: host features: 0x710006d4
virtio_pci2: negotiated features: 0x10000254
vtblk1: 327680MB (671088640 512 byte sectors)
virtio_pci3: port 0xc100-0xc11f irq 10 at device 6.0 on pci0
vtballoon0: on virtio_pci3
virtio_pci3: host features: 0x71000002
virtio_pci3: negotiated features: 0x0 [7/403]
atkbdc0: port 0x60,0x64 irq 1 on acpi0
atkbd0: irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model IntelliMouse Explorer, device ID 4
fdc0: port 0x3f2-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: does not respond
device_attach: fdc0 attach returned 6
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (9600,n,8,1)
orm0: at iomem 0xc9000-0xc97ff on isa0
sc0: at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x100>
vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
attimer0: at port 0x40 on isa0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
fdc0: No FDOUT register!
ppc0: cannot reserve I/O port range
ctl: CAM Target Layer loaded
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
ugen0.1: at usbus0
uhub0: on usbus0
GEOM: vtbd1: corrupt or invalid GPT detected.
GEOM: vtbd1: GPT rejected -- may not be recoverable.
uhub0: 2 ports with 2 removable, self powered
ugen0.2: at usbus0
uhid0: on usbus0
cd0 at ata0 bus 0 scbus0 target 0 lun 0
cd0: Removable CD-ROM SCSI-0 device
cd0: 16.700MB/s transfers (WDMA2, ATAPI 12bytes, PIO 65534bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present
SMP: AP CPU #1 Launched!
SMP: AP CPU #3 Launched!
SMP: AP CPU #2 Launched!
Timecounter "TSC-low" frequency 9896395 Hz quality 1000
Trying to mount root from ufs:/dev/vtbd0p3 [rw]...
試しにメモリ1GBプラン(60日体験版)も試してみたところ、CentOS6.2(linux-2.6.32, virtio有効)で だいたい100〜130MB/sだった。どうやら容量だけでなく速度の面でも4GBプランはメリットがある模様。
余談
いつものようにファイアウォールはpfでいこうとしたところ、pfctl -eした瞬間 何故かダウンロードのみ激遅(10KB/sぐらい)になったりと散々だったので、ipfwを覚えることに。 VIMAGEもいろいろと不具合があってハマりまくったので今回は見送り。