Re: new database files not compressed

Nikolay Borisov
2020-09-01T05:15:28Z

On 1.09.20 г. 2:50 ч., Hamish Moffatt wrote:
> On 31/8/20 10:57 pm, Nikolay Borisov wrote:
>>
>> This means the data being passed to btrfs is not compressible. I.e after
>> coompression the data is not smaller than the original, input data.
>
> It is though - if I copy it, or run defrag, it compresses very well:
>
>

As Zygo explained - with 16k writes you'd need at least 25% compression
in order for btrfs to deem it useful. If firebird's 16k writes are not
25% compressible then it won't compress. It also depends on whether it
issues fsync after every write to ensure consistency meaning it won't
allow more data to accumulate.

> $ mount | grep btrfs
> /dev/sdb on /mnt/test type btrfs
> (rw,relatime,compress-force=zstd:3,space_cache,subvolid=5,subvol=/)
> $ zcat ~/*.zip | gbak -REP -page 16384 stdin test2.fdb
> $ sudo compsize test2.fdb
> Type       Perc     Disk Usage   Uncompressed Referenced
> TOTAL      100%      194M         194M         191M
> none       100%      194M         194M         191M
>
> $ dd if=test2.fdb of=test2.fdb2 bs=16k
> 12250+0 records in
> 12250+0 records out
> 200704000 bytes (201 MB, 191 MiB) copied, 0.151375 s, 1.3 GB/s
> $ sync
> $ sudo compsize test2.fdb2
> Type       Perc     Disk Usage   Uncompressed Referenced
> TOTAL        8%       17M         191M         191M
> zstd         8%       17M         191M         191M
>
> $ sudo btrfs fi defrag -czstd test2.fdb
> $ sudo compsize test2.fdb
> Type       Perc     Disk Usage   Uncompressed Referenced
> TOTAL        8%       17M         191M         191M
> zstd         8%       17M         191M         191M
>
>
> So it must be something about how Firebird is creating or writing the
> file, as Zygo wrote. I set the page size to 16k (default 4k) and
> although I see Firebird making 16k writes, it is not affecting the result.
>
>
> Hamish
>