All of lore.kernel.org
 help / color / mirror / Atom feed
* Btrfs autodefrag wrote 5TB in one day to a 0.5TB SSD without a measurable benefit
@ 2022-03-06 15:59 Jan Ziak
  2022-03-07  0:48 ` Qu Wenruo
                   ` (2 more replies)
  0 siblings, 3 replies; 71+ messages in thread
From: Jan Ziak @ 2022-03-06 15:59 UTC (permalink / raw)
  To: linux-btrfs

I would like to report that btrfs in Linux kernel 5.16.12 mounted with
the autodefrag option wrote 5TB in a single day to a 1TB SSD that is
about 50% full.

Defragmenting 0.5TB on a drive that is 50% full should write far less than 5TB.

Benefits to the fragmentation of the most written files over the
course of the one day (sqlite database files) are nil. Please see the
data below. Also note that the sqlite file is using up to 10 GB more
than it should due to fragmentation.

CPU utilization on an otherwise idle machine is approximately 600% all
the time: btrfs-cleaner 100%, kworkers...btrfs 500%.

I am not just asking you to fix this issue - I am asking you how is it
possible for an algorithm that is significantly worse than O(N*log(N))
to be merged into the Linux kernel in the first place!?

Please try to avoid discussing no-CoW (chattr +C) in your response,
because it is beside the point. Thanks.

----

A day before:

$ smartctl -a /dev/nvme0n1 | grep Units
Data Units Read:                    449,265,485 [230 TB]
Data Units Written:                 406,386,721 [208 TB]

$ compsize file.sqlite
Processed 1 file, 1757129 regular extents (2934077 refs), 0 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%       46G          46G          37G
none       100%       46G          46G          37G

----

A day after:

$ smartctl -a /dev/nvme0n1 | grep Units
Data Units Read:                    473,211,419 [242 TB]
Data Units Written:                 417,249,915 [213 TB]

$ compsize file.sqlite
Processed 1 file, 1834778 regular extents (3050838 refs), 0 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%       47G          47G          37G
none       100%       47G          47G          37G

$ filefrag file.sqlite
(Ctrl-C after waiting more than 10 minutes, consuming 100% CPU)

----

Manual defragmentation decreased the file's size by 7 GB:

$ btrfs-defrag file.sqlite
$ sync
$ compsize file.sqlite
Processed 6 files, 13074 regular extents (20260 refs), 0 inline.
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%       40G          40G          37G
none       100%       40G          40G          37G

----

Sincerely
Jan

^ permalink raw reply	[flat|nested] 71+ messages in thread
* Re: Btrfs autodefrag wrote 5TB in one day to a 0.5TB SSD without a measurable benefit
@ 2022-06-17  0:20 Jan Ziak
  0 siblings, 0 replies; 71+ messages in thread
From: Jan Ziak @ 2022-06-17  0:20 UTC (permalink / raw)
  To: linux-btrfs

This is a random update to previously reported btrfs fragmentation issues.

Defragmenting a 79 GiB file increased the number of bytes allocated to
the file in a btrfs filesystem from 118 GIB to 161 GiB:

linux 5.17.5
btrfs-progs 5.18.1

$ compsize file.sqlite
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       99%      117G         118G          78G
none       100%      116G         116G          77G
zstd        30%      471M         1.5G         1.2G

$ btrfs filesystem defragment -t 256K file.sqlite

$ compsize file.sqlite
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       99%      160G         161G          78G
none       100%      159G         159G          77G
zstd        28%      405M         1.3G         1.3G

$ dd if=file.sqlite of=file-1.sqlite bs=1M status=progress
84659167232 bytes (85 GB, 79 GiB) copied, 122.376 s, 692 MB/s

$ compsize file-1.sqlite
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       98%       77G          78G          78G
none       100%       77G          77G          77G
zstd        28%      361M         1.2G         1.2G

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2022-06-17  0:21 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-06 15:59 Btrfs autodefrag wrote 5TB in one day to a 0.5TB SSD without a measurable benefit Jan Ziak
2022-03-07  0:48 ` Qu Wenruo
2022-03-07  2:23   ` Jan Ziak
2022-03-07  2:39     ` Qu Wenruo
2022-03-07  7:31       ` Qu Wenruo
2022-03-10  1:10         ` Jan Ziak
2022-03-10  1:26           ` Qu Wenruo
2022-03-10  4:33             ` Jan Ziak
2022-03-10  6:42               ` Qu Wenruo
2022-03-10 21:31                 ` Jan Ziak
2022-03-10 23:27                   ` Qu Wenruo
2022-03-11  2:42                     ` Jan Ziak
2022-03-11  2:59                       ` Qu Wenruo
2022-03-11  5:04                         ` Jan Ziak
2022-03-11 16:31                           ` Jan Ziak
2022-03-11 20:02                             ` Jan Ziak
2022-03-11 23:04                             ` Qu Wenruo
2022-03-11 23:28                               ` Jan Ziak
2022-03-11 23:39                                 ` Qu Wenruo
2022-03-12  0:01                                   ` Jan Ziak
2022-03-12  0:15                                     ` Qu Wenruo
2022-03-12  3:16                                     ` Zygo Blaxell
2022-03-12  2:43                                 ` Zygo Blaxell
2022-03-12  3:24                                   ` Qu Wenruo
2022-03-12  3:48                                     ` Zygo Blaxell
2022-03-14 20:09                         ` Phillip Susi
2022-03-14 22:59                           ` Zygo Blaxell
2022-03-15 18:28                             ` Phillip Susi
2022-03-15 19:28                               ` Jan Ziak
2022-03-15 21:06                               ` Zygo Blaxell
2022-03-15 22:20                                 ` Jan Ziak
2022-03-16 17:02                                   ` Zygo Blaxell
2022-03-16 17:48                                     ` Jan Ziak
2022-03-17  2:11                                       ` Zygo Blaxell
2022-03-16 18:46                                 ` Phillip Susi
2022-03-16 19:59                                   ` Zygo Blaxell
2022-03-20 17:50                             ` Forza
2022-03-20 21:15                               ` Zygo Blaxell
2022-03-08 21:57       ` Jan Ziak
2022-03-08 23:40         ` Qu Wenruo
2022-03-09 22:22           ` Jan Ziak
2022-03-09 22:44             ` Qu Wenruo
2022-03-09 22:55               ` Jan Ziak
2022-03-09 23:00                 ` Jan Ziak
2022-03-09  4:48         ` Zygo Blaxell
2022-03-07 14:30 ` Phillip Susi
2022-03-08 21:43   ` Jan Ziak
2022-03-09 18:46     ` Phillip Susi
2022-03-09 21:35       ` Jan Ziak
2022-03-14 20:02         ` Phillip Susi
2022-03-14 21:53           ` Jan Ziak
2022-03-14 22:24             ` Remi Gauvin
2022-03-14 22:51               ` Zygo Blaxell
2022-03-14 23:07                 ` Remi Gauvin
2022-03-14 23:39                   ` Zygo Blaxell
2022-03-15 14:14                     ` Remi Gauvin
2022-03-15 18:51                       ` Zygo Blaxell
2022-03-15 19:22                         ` Remi Gauvin
2022-03-15 21:08                           ` Zygo Blaxell
2022-03-15 18:15             ` Phillip Susi
2022-03-16 16:52           ` Andrei Borzenkov
2022-03-16 18:28             ` Jan Ziak
2022-03-16 18:31             ` Phillip Susi
2022-03-16 18:43               ` Andrei Borzenkov
2022-03-16 18:46               ` Jan Ziak
2022-03-16 19:04               ` Zygo Blaxell
2022-03-17 20:34                 ` Phillip Susi
2022-03-17 22:06                   ` Zygo Blaxell
2022-03-16 12:47 ` Kai Krakow
2022-03-16 18:18   ` Jan Ziak
2022-06-17  0:20 Jan Ziak

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.