All of lore.kernel.org
 help / color / mirror / Atom feed
From: Victor Stinner <victor.stinner@haypocalc.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: Issues with KVM
Date: Mon, 25 Jul 2011 16:04:49 +0200	[thread overview]
Message-ID: <4E2D7801.80207@haypocalc.com> (raw)
In-Reply-To: <CAGAVQTGdEQdS+rE-D=fd4GXgaufpdR6J5xgNUjRa+N402Ge5-g@mail.gmail.com>

On 22/07/2011 21:59, C Anthony Risinger wrote:
 > is the disk's cache mode set to none [or maybe writeback]
 > (virtmanager)?

I tested various options: the most important is the cache mode.

cache=none is a little bit better than cache=default (writethrough), but 
there is an huge difference using cache=unsafe. This option is not 
supported by virt-manager, but by kvm. Using cache=unsafe, the 
installation of FreeBSD is ~100x faster:

  - cache=default: write at 1 to 8 KB/sec
  - cache=none: write at 40 KB/sec
  - cache=unsafe: write at 1200 KB/sec

According to agraf__ on IRC (#kvm on FreeNode), the cache mode has the 
following effect:

  - cache=writethrough calls fsync() after every write()
  - cache=none uses O_DIRECT
  - cache=writeback calls fsync() when the guest issues a barrier() 
(don't use O_DIRECT)
  - cache=unsafe doesn't do any fsync() (but don't use O_DIRECT)

I still have to test writeback ;-)

I found another mail thread, of last summer (July 2010), which is 
exactly the same problem that I had: "BTRFS: Unbelievably slow with 
kvm/qemu" on this mailing list. It contains another advice:

"Make sure you build your file system with "mkfs.btrfs -m single -d 
single /dev/whatever". You may well be writing duplicate copies of 
everything."

http://lkml.org/lkml/2010/7/12/5

--

FreeBSD installation in VirtualBox is as fast (or maybe a little bit 
slower) than the installation in kvm using cache=unsafe. I suppose that 
VirtualBox uses something like cache=unsafe or cache=writeback.

Victor

  parent reply	other threads:[~2011-07-25 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-22 19:44 Issues with KVM Victor Stinner
2011-07-22 19:59 ` C Anthony Risinger
2011-07-22 20:00   ` C Anthony Risinger
2011-07-23  9:20   ` Victor Stinner
2011-07-25 14:04   ` Victor Stinner [this message]
2011-07-25 16:22     ` Christoph Hellwig
2011-07-22 20:44 ` Josef Bacik
2011-07-22 21:03 ` Morten P.D. Stevens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2D7801.80207@haypocalc.com \
    --to=victor.stinner@haypocalc.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.