From: "Richard W.M. Jones" <rjones@redhat.com>
To: Nikita A Menkovich <menkovich@gmail.com>
Cc: libvirt-users@redhat.com, qemu-devel@nongnu.org, libguestfs@redhat.com
Subject: Re: [Qemu-devel] [Libguestfs] Problem with allocation of big files
Date: Tue, 20 Sep 2011 12:16:49 +0100 [thread overview]
Message-ID: <20110920111649.GA18471@amd.home.annexia.org> (raw)
In-Reply-To: <CAGjwFiPqTth2dprwGXQW4TWnBYyqgSLMHt0_0OB1zE3YBUTneQ@mail.gmail.com>
On Tue, Sep 20, 2011 at 11:38:15AM +0400, Nikita A Menkovich wrote:
> Hello,
>
> I found a strange problem with allocationg big files on drive.
>
> For example in guestfish I allocate large disk image
> for example:
>
> $ guestfish
> ><fs> allocate test.img 20G
>
> When an image allocating, there is a big slowdown of guest OSes,
> launched on host machine, and on different drives.
I'm guessing this is a problem with the host kernel (Linux?).
Specifically you may be saturating SATA, your Southbridge, or PCI if
it's using that.
Here is the code anyway:
http://git.annexia.org/?p=libguestfs.git;a=blob;f=fish/alloc.c;h=7799e4e1c5f0b34ce079934eea7d7c0a13ecdcd3;hb=refs/heads/stable-1.10#l85
Notice that the 'allocate' command takes the non-sparse code path.
What happens next depends on:
- does your operating system have the posix_fallocate call?
- does your filesystem support efficient fallocate? (ext3: no, ext4: yes,
xfs: yes)
If the answer to either question is 'no' then you end up in a loop
which writes zeroes. For a 20 GB file this is going to be slow and is
going to saturate SATA.
If the answer to *both* questions is 'yes', then ext4/xfs should be
able to allocate the required extents and lazily initialize it. This
is typically very fast, almost instantaneous.
> For Linux guests with virtio drivers, there is no so big performance
> penalty, but for FreeBSD guests with ide it seems like the OS locked.
>
> Manipulating with ionice and niceness do not affect at all.
>
> Manipulating with cfq, deadline schedulers also do not have any results.
>
> OS Debian Squeeze
> libvirtd (libvirt) 0.9.2
> QEMU emulator version 0.14.0 (Debian 0.14.0+dfsg-5.1), Copyright (c)
> 2003-2008 Fabrice Bellard
> guestfish 1.10.3 with some local patches, backported from main tree
>
> Does anyone have ideas how to fix it?
Probably the best idea is to use ext4, or use 'sparse' instead of
'allocate' (but with 'sparse' you pay the same penalty, just you pay
for it later on).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
prev parent reply other threads:[~2011-09-20 11:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-20 7:38 [Qemu-devel] Problem with allocation of big files Nikita A Menkovich
2011-09-20 11:16 ` Richard W.M. Jones [this message]
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=20110920111649.GA18471@amd.home.annexia.org \
--to=rjones@redhat.com \
--cc=libguestfs@redhat.com \
--cc=libvirt-users@redhat.com \
--cc=menkovich@gmail.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).