From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs-cleaner leaves CPU pinned to 100%
Date: Thu, 5 Dec 2013 10:27:14 +0000 (UTC) [thread overview]
Message-ID: <pan$f2236$913cfbec$e1280556$6e940b4f@cox.net> (raw)
In-Reply-To: CALnfhZDW4w4kuLPf1pYEMkW-d_aV+o7tHawbrNi+3JX7jeqzFA@mail.gmail.com
Adam G posted on Wed, 04 Dec 2013 19:19:15 -0500 as excerpted:
> I recreated the problem by booting with autodefrag enabled and loading a
> large VirtualBox image of Windows 8.1. The CPU is pinned to 100%
> even after closing the VirtualBox software.
Virtual images!
That's your problem! Any large and frequently internally written files
(as opposed to appended such as logs or write-once files such as most
media files), including both large databases and virtual machine images,
are going to be an issue on any COW (copy-on-write) filesystem such as
btrfs, since they'll very quickly become very heavily fragmented due to
the constant internal writes creating fragments.
And virtual machine images are a classic example, often being several
gigs (if not tens of gigs) in size, with frequent writes to data in the
center of the image.
As a consequence, it's strongly recommended that VM images are set NOCOW,
so writes will happen in-place, instead of fragmenting the image.
Without that... well, the poor defragmenter was working overtime to try
and fix the fragments, and all those fragments were certainly dragging
down your VM performance as well.
For curiosity sake, you might try running filefrag on that image and see
just how fragmented it was.
As for setting NOCOW, note that the attribute must be set before the file
has any data in it. There are two common ways to do that. The easy way
is to create a directory for your VM images and set the attribute on it,
then copy the vm images into it. An alternative is to touch the
individual file to create it at zero size, set the attribute, then copy
the data into it from the existing file.
After doing that with all your VM images and deleting the old/fragmented
copies, the pegged cpu defrag thread issue should disappear or at least
dramatically reduce, and you may well notice a performance boost in your
VMs as well. =:^)
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
prev parent reply other threads:[~2013-12-05 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 17:28 btrfs-cleaner leaves CPU pinned to 100% Adam G
2013-12-04 15:27 ` Adam Gradzki
2013-12-04 17:49 ` Josef Bacik
[not found] ` <CALnfhZAEg1EgtDmZ6Qka=Ka-oaUmg++3mN3M=qOf5BHtEXXPpA@mail.gmail.com>
2013-12-05 0:19 ` Adam G
2013-12-05 10:27 ` Duncan [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='pan$f2236$913cfbec$e1280556$6e940b4f@cox.net' \
--to=1i5t5.duncan@cox.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox