From owner-freebsd-emulation@FreeBSD.ORG Wed May 4 11:36:45 2011 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71AD8106566C for ; Wed, 4 May 2011 11:36:45 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mx1.freebsd.org (Postfix) with ESMTP id E71768FC0A for ; Wed, 4 May 2011 11:36:44 +0000 (UTC) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QHaNn-0007gm-6T for freebsd-emulation@freebsd.org; Wed, 04 May 2011 13:36:43 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 May 2011 13:36:43 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 04 May 2011 13:36:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-emulation@freebsd.org From: Ivan Voras Date: Wed, 04 May 2011 13:36:31 +0200 Lines: 66 Message-ID: References: <32556218.1304447122068.JavaMail.root@mswamui-blood.atl.sa.earthlink.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.12) Gecko/20101102 Thunderbird/3.1.6 In-Reply-To: <32556218.1304447122068.JavaMail.root@mswamui-blood.atl.sa.earthlink.net> X-Enigmail-Version: 1.1.2 Subject: Re: virtualbox I/O 3 times slower than KVM? X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2011 11:36:45 -0000 On 03/05/2011 20:25, John wrote: > What I do is to cat the 330MB binary file (XP service pack from Microsoft) 20 times into a single 6.6GB file, "date" before and afterwards, and after the second date finishes, immediately Force power shut down. There are two observations: > > 1. the time to complete copying into this 6.6GB file were 72s, 44s, 79s in three runs, presumably because there is another production VM on the same host. The average is 65s, so it's about 100MB/s. > 2. After immediately power down, I do found the resulting file was less than 6.6GB. So indeed the VM claimed the completion of the copying before it actually did. > > I then did the same thing on the virtualbox, since I don't want the above premature I/O, I made sure the "Use Host I/O cache" is unchecked for the VM storage. > > 1. the time to complete copying into this 6.6GB file was 119s and 92s, the average is 105s, so the speed is 62MB/s. > 2. after immediately "Reset" the machine, I couldn't boot. Both times it asked me to do fsck for that partition (GPT 2.2T). But after finally powering up, I found the file was also less than 6.6GB both times as well. > > So looks like virtualbox also suffers caching problem? Or did I do anything wrong? Aaargh. Please don't invent benchmarks. The ones which are already around have enough troubles by themselves. Instead, if you really want to do a proper comparison of the systems, do this (in the order I've written): 1) add these lines to /etc/sysctl.conf: vfs.hirunningspace=8388608 vfs.lorunningspace=6291456 vfs.read_max=128 2) configure the FreeBSD system to use AHCI http://ivoras.net/blog/tree/2009-11-17.trying-ahci-in-8.0.html 3) use benchmarks/bonnie++ from ports for benchmarking. Note that you need to run *the same version of the benchmark* on all systems (i.e. also on Linux) to be able do do comparison. Any do-it-yourself benchmarks you do are very likely meaningless and you cannot conclude anything from them. Even with this, there could be *huge* differences in the results simply as a consequence of rotational positions of virtual drives on the physical one. See this results (note the transfer rate results). lara:~# diskinfo -vt /dev/ada0 /dev/ada0 512 # sectorsize 500107862016 # mediasize in bytes (466G) 976773168 # mediasize in sectors 0 # stripesize 0 # stripeoffset 969021 # Cylinders according to firmware. 16 # Heads according to firmware. 63 # Sectors according to firmware. 6QG3Z026 # Disk ident. Seek times: Full stroke: 250 iter in 5.671675 sec = 22.687 msec Half stroke: 250 iter in 4.294470 sec = 17.178 msec Quarter stroke: 500 iter in 6.793844 sec = 13.588 msec Short forward: 400 iter in 2.637252 sec = 6.593 msec Short backward: 400 iter in 2.320116 sec = 5.800 msec Seq outer: 2048 iter in 0.217796 sec = 0.106 msec Seq inner: 2048 iter in 0.218317 sec = 0.107 msec Transfer rates: outside: 102400 kbytes in 1.221390 sec = 83839 kbytes/sec middle: 102400 kbytes in 1.445180 sec = 70856 kbytes/sec inside: 102400 kbytes in 2.451970 sec = 41762 kbytes/sec Benchmarking file systems and drive IO is complicated :)