From: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
To: James Pharaoh <james@wellbehavedsoftware.com>
Cc: Mark Fasheh <mfasheh@versity.com>, linux-btrfs@vger.kernel.org
Subject: Re: Announcing btrfs-dedupe
Date: Mon, 14 Nov 2016 13:43:21 -0500 [thread overview]
Message-ID: <20161114184320.GH21290@hungrycats.org> (raw)
In-Reply-To: <a4e42724-d84a-e4f9-a3ea-d1fec31a5629@wellbehavedsoftware.com>
[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]
On Mon, Nov 14, 2016 at 07:22:59PM +0100, James Pharaoh wrote:
> On 14/11/16 19:07, Zygo Blaxell wrote:
> >There is also a still-unresolved problem where the filesystem CPU usage
> >rises exponentially for some operations depending on the number of shared
> >references to an extent. Files which contain blocks with more than a few
> >thousand shared references can trigger this problem. A file over 1TB can
> >keep the kernel busy at 100% CPU for over 40 minutes at a time.
>
> Yes, I see this all the time. For my use cases, I don't really care about
> "shared references" as blocks of files, but am happy to simply deduplicate
> at the whole-file level. I wonder if this still will have the same effect,
> however. I guess that this could be mitigated in a tool, but this is going
> to be both annoying and not the most elegant solution.
If you have huge files (1TB+) this can be a problem even with whole-file
deduplications (which are really just extent-level deduplications applied
to the entire file). The CPU time is a product of file size and extent
reference count with some other multipliers on top.
I've hacked around it by timing how long it takes to manipulate the data,
and blacklisting any hash value or block address that takes more than
10 seconds to process (if such a block is found after blacklisting, just
skip processing the block/extent/file entirely). It turns out there are
very few of these in practice (only a few hundred per TB) but these few
hundred block hash values occur millions of times in a large data corpus.
> One thing I am keen to understand is if BTRFS will automatically ignore a
> request to deduplicate a file if it is already deduplicated? Given the
> performance I see when doing a repeat deduplication, it seems to me that it
> can't be doing so, although this could be caused by the CPU usage you
> mention above.
As far as I can tell btrfs doesn't do anything different in this
case--it'll happily repeat the entire lock/read/compare/delete/insert
sequence even if the outcome cannot be different from the initial
conditions. Due to limitations of VFS caching it'll read the same blocks
from storage hardware twice, too.
> In any case, I'm considering some digging into the filesystem structures to
> see if I can work this out myself before i do any deduplication. I'm fairly
> sure this should be relatively simple to work out, at least well enough for
> my purposes.
I used FIEMAP (then later replaced it with SEARCH_V2 for speed) to map
the extents to physical addresses before deduping them. If you're only
going to do whole-file dedup then you only need to care about the physical
address of the first non-hole extent.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2016-11-14 18:43 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-06 13:30 Announcing btrfs-dedupe James Pharaoh
2016-11-07 14:02 ` David Sterba
2016-11-07 17:48 ` Mark Fasheh
2016-11-07 20:54 ` Adam Borowski
2016-11-08 2:17 ` Darrick J. Wong
2016-11-08 18:59 ` Mark Fasheh
2016-11-08 19:47 ` Darrick J. Wong
2016-11-08 19:47 ` [Ocfs2-devel] " Darrick J. Wong
2016-11-09 15:02 ` David Sterba
2016-11-08 2:40 ` Christoph Anton Mitterer
2016-11-08 6:11 ` James Pharaoh
2016-11-08 13:26 ` Austin S. Hemmelgarn
2016-11-08 16:57 ` Darrick J. Wong
2016-11-08 17:04 ` Austin S. Hemmelgarn
2016-11-08 18:49 ` Mark Fasheh
2016-11-07 17:59 ` Mark Fasheh
2016-11-07 18:49 ` James Pharaoh
2016-11-07 18:53 ` James Pharaoh
2016-11-14 18:07 ` Zygo Blaxell
2016-11-14 18:22 ` James Pharaoh
2016-11-14 18:39 ` Austin S. Hemmelgarn
2016-11-14 19:51 ` Zygo Blaxell
2016-11-14 19:56 ` Austin S. Hemmelgarn
2016-11-14 21:10 ` Zygo Blaxell
2016-11-15 12:26 ` Austin S. Hemmelgarn
2016-11-15 17:52 ` Zygo Blaxell
2016-11-16 22:24 ` Niccolò Belli
2016-11-17 3:01 ` Zygo Blaxell
2016-11-18 10:36 ` Niccolò Belli
2016-11-14 20:07 ` James Pharaoh
2016-11-14 21:22 ` Zygo Blaxell
2016-11-14 18:43 ` Zygo Blaxell [this message]
2016-11-08 11:06 ` Niccolò Belli
2016-11-08 11:38 ` James Pharaoh
2016-11-08 16:57 ` Niccolò Belli
2016-11-08 16:58 ` James Pharaoh
2016-11-08 17:08 ` Niccolò Belli
2016-11-14 18:27 ` Zygo Blaxell
2016-11-08 22:36 ` Saint Germain
2016-11-09 11:24 ` Niccolò Belli
2016-11-09 12:47 ` Saint Germain
2016-11-13 12:45 ` James Pharaoh
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=20161114184320.GH21290@hungrycats.org \
--to=ce3g8jdj@umail.furryterror.org \
--cc=james@wellbehavedsoftware.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mfasheh@versity.com \
/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.