From: David Sterba <dsterba@suse.cz>
To: Integral <integral@archlinuxcn.org>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Maybe we can set default zstd compression level to 1 when SSD detected?
Date: Wed, 16 Apr 2025 12:06:34 +0200 [thread overview]
Message-ID: <20250416100634.GB13877@suse.cz> (raw)
In-Reply-To: <8c2e5d04-dbda-4b12-992e-34f0e70c7218@archlinuxcn.org>
On Sun, Apr 13, 2025 at 12:07:26PM +0800, Integral wrote:
> Hi,
>
> When SSD is detected, maybe we can set default zstd compression level to 1.
>
> Current default compression level for zstd is 3, which is not optimal
> for SSDs.
>
> This GitHub Gist [1] can serve as a reference.
Well, while the linked gist is thorough I don't see that zstd:1 clearly
wins against zstd:3. The compression brings overhead (more extents, CPU
cost) so the preferred criteria should be space savings. The runtimes of
read and write seem to be roughly the same.
I haven't found any description or classification of the input data
(other than known to be incompressible). This is an important factor.
> An example is Fedora Workstation [2], which uses `zstd:1` as default
> compression option.
>
> [1] Link:
> https://gist.github.com/braindevices/fde49c6a8f6b9aaf563fb977562aafec
>
> [2] Link: https://fedoraproject.org/wiki/Changes/BtrfsTransparentCompression
Unfortunately the Fedora evaluation disqualifies itself because it uses
/dev/urandom (practically incompressible) and /dev/zero (trivially
compressible). I would not select the default based on that benchmark
for the wole distro, it's IMHO flawed or incomplete at best.
For the evaluation I recommend some commonly found data types based on
their compressibility, like we did for the recent fast zstd levels
https://lore.kernel.org/linux-btrfs/20250128132235.1356769-1-neelx@suse.com/ .
Binaries, documentation, enwik9 (commonly used for compression
benchmarks), linux sources.
The classes are not exact but should represent files that are common
and have a chance of being considered for compression. Already
compressed files or other hard to compress files like media are
detected and not considered by the heuristic.
Changing defaults is possible but it affects everybody and from past
experience breaks somebody's use case or negatively affects performance.
The evaluation from the gist could be enhanced with more input data
types and CPU strengths.
next prev parent reply other threads:[~2025-04-16 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-13 4:07 Maybe we can set default zstd compression level to 1 when SSD detected? Integral
2025-04-16 10:06 ` David Sterba [this message]
2025-04-20 6:01 ` Neal Gompa
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=20250416100634.GB13877@suse.cz \
--to=dsterba@suse.cz \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=integral@archlinuxcn.org \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--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