public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Giangiacomo Mariotti <gg.mariotti@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: BTRFS: Unbelievably slow with kvm/qemu
Date: Wed, 14 Jul 2010 15:49:05 -0400	[thread overview]
Message-ID: <20100714194905.GA20286@infradead.org> (raw)
In-Reply-To: <AANLkTin1uF6WbVvxJ84oO1NKnCU-6VHrmWU1XFYTlqtp@mail.gmail.com>

There are a lot of variables when using qemu.

The most important one are:

 - the cache mode on the device.  The default is cache=writethrough,
   which is not quite optimal.  You generally do want to use cache=none
   which uses O_DIRECT in qemu.
 - if the backing image is sparse or not.
 - if you use barrier - both in the host and the guest.

Below I have a table comparing raw blockdevices, xfs, btrfs, ext4 and
ext3.  For ext3 we also compare the default, unsafe barrier=0 version
and the barrier=1 version you should use if you actually care about
your data.

The comparism is a simple untar of a Linux 2.6.34 tarball, including a
sync after it.  We run this with ext3 in the guest, either using the
default barrier=0, or for the later tests also using barrier=1.  It
is done on an OCZ Vertext SSD, which gets reformatted and fully TRIMed
before each test.

As you can see you generally do want to use cache=none and every
filesystem is about the same speed for that - except that on XFS you
also really need preallocation.  What's interesting is how bad btrfs
is for the default compared to the others, and that for many filesystems
things actually get minimally faster when enabling barriers in the
guest.  Things will look very different for barrier heavy guest, I'll
do another benchmark for those.

							bdev		xfs		btrfs		ext4		ext3		ext3 (barrier)

cache=writethrough	nobarrier	sparse		0m27.183s	0m42.552s	2m28.929s	0m33.749s	0m24.975s	0m37.105s
cache=writethrough	nobarrier	prealloc	-		0m32.840s	2m28.378s	0m34.233s	-		-

cache=none		nobarrier	sparse		0m21.988s	0m49.758s	0m24.819s	0m23.977s	0m22.569s	0m24.938s
cache=none		nobarrier	prealloc	-		0m24.464s	0m24.646s	0m24.346s	-		-

cache=none		barrier		sparse		0m21.526s	0m41.158s	0m24.403s	0m23.924s	0m23.040s	0m23.272s
cache=none		barrier		prealloc	-		0m23.944s	0m24.284s	0m23.981s	-		-

  parent reply	other threads:[~2010-07-14 19:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  5:24 BTRFS: Unbelievably slow with kvm/qemu Giangiacomo Mariotti
2010-07-12  5:54 ` Justin P. Mattock
2010-07-12  7:09 ` Michael Tokarev
2010-07-12  7:17   ` Justin P. Mattock
2010-07-12 13:15     ` Giangiacomo Mariotti
2010-07-12 13:34   ` Giangiacomo Mariotti
2010-07-12 13:40     ` Michael Tokarev
2010-07-12 13:43     ` Josef Bacik
2010-07-12 13:42       ` Michael Tokarev
2010-07-12 13:49         ` Josef Bacik
2010-07-12 20:23       ` Giangiacomo Mariotti
2010-07-12 20:24         ` Josef Bacik
2010-07-13  8:53       ` [Qemu-devel] " Kevin Wolf
2010-07-13  4:29 ` Avi Kivity
2010-07-14  2:39   ` Giangiacomo Mariotti
2010-07-14 19:49 ` Christoph Hellwig [this message]
2010-07-17  5:29   ` Giangiacomo Mariotti
2010-07-17 10:28   ` Ted Ts'o
2010-07-18  7:15     ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2010-08-29 19:34 Tomasz Chmielewski
2010-08-30  0:14 ` Josef Bacik
2010-08-30 15:59   ` K. Richard Pixley
2010-08-31 21:46     ` Mike Fedyk
2010-08-31 22:01       ` K. Richard Pixley
     [not found]       ` <4C7D7B14.9020008@noir.com>
2010-09-02  0:18         ` Ted Ts'o
2010-09-02 16:36           ` K. Richard Pixley
2010-09-02 16:49             ` K. Richard Pixley

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=20100714194905.GA20286@infradead.org \
    --to=hch@infradead.org \
    --cc=gg.mariotti@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox