Live data from Hacker News

Zstandard RFC 8878

datatracker.ietf.org

31–40 of 45 posts

Re: Zstandard RFC 8878

#31
post #11

Zstd is an amazing bit of work and all I ever use for data compression nowadays (or LZ4 when speed is even more critical). Several times the compression/decompression speed of gzip, approximately the same compression ratio with default settings. It's also supported by tar in recent Linux distros, if zstd is installed, so "tar acf blah.tar.zst *" works fine, and "tar xf blah.tar.zst" works automatically as well. Give…

> Several times the compression/decompression speed of gzip

Just be careful that you're comparing against the best implementation of gzip. One recent re-implementation of zcat was 3.1x faster than /bin/zcat (and the CRC-32 implementation within was 7.3x faster than /bin/crc32). Both programs decode exactly the same file format. They're just different implementations. For details, see: https://nigeltao.github.io/blog/2021/fastest-safest-png-deco...

Re: Zstandard RFC 8878

#33
post #3

Does this mean the Zstd magic number is now cast in stone?

You may have mistaken Brotli (whose file format has no magic number and prevents an easy identification) with Zstandard (whose file format does have defined magic numbers 28 B5 2F FD or [50-5F] 2A 4D 18).

No I'm not confused, it's just that the Zstd magic number has had 8 different values over the years, so I'm just wondering if we're past that yet.

Re: Zstandard RFC 8878

#34
post #21
post #19

Earlier quoted context omitted.

I get why someone might want to avoid .zstd ; but that is the short name offered for humans. Was .zs not sufficient if a file format ending in 'std' is so abhorrent?

I'm not the one who came up with the extension. It just sort of organically happened I guess. I'd prefer "zstd" myself, but, frankly, "zst" is fine as well.

Four letter extensions work really well for .java and .json. It seems strange the abbreviate zstd anymore.

Re: Zstandard RFC 8878

#35
post #24

It's said to be a good fit for ZFS. I tend to lz4 because its baked into the older systems I use, but it may be at a point where my default should be zstd. bz2/gz still predominates for compressed objects in filestore from what I can see.

[deleted]

Re: Zstandard RFC 8878

#36
post #33

Earlier quoted context omitted.

You may have mistaken Brotli (whose file format has no magic number and prevents an easy identification) with Zstandard (whose file format does have defined magic numbers 28 B5 2F FD or [50-5F] 2A 4D 18).

No I'm not confused, it's just that the Zstd magic number has had 8 different values over the years, so I'm just wondering if we're past that yet.

Ah sure. The wire format has been fixed since 0.8.0 (2016-08), so you must have seen a very early phase of development (which took one full year).

Re: Zstandard RFC 8878

#37
post #21

Earlier quoted context omitted.

I'm not the one who came up with the extension. It just sort of organically happened I guess. I'd prefer "zstd" myself, but, frankly, "zst" is fine as well.

Four letter extensions work really well for .java and .json. It seems strange the abbreviate zstd anymore.

I'like to point out though that "zstd" is itself an abbreviation, and "zstandard" would be quite onerous.

Re: Zstandard RFC 8878

#38
post #24

It's said to be a good fit for ZFS. I tend to lz4 because its baked into the older systems I use, but it may be at a point where my default should be zstd. bz2/gz still predominates for compressed objects in filestore from what I can see.

>It's said to be a good fit for ZFS. I tend to lz4 because its baked into the older systems I use, but it may be at a point where my default should be zstd.

It is, and you should definitely at least give it a look. I posted a comment mentioning it the other day in the OpenZFS 2.0 thread [0], and it also came up recently on HN in a thread linked there, but there are some interesting performance graphs comparing different standards in the github PR for zstd in ZFS [1]. LZ4 still has its place IMO, ZFS is not run nor good for exclusively heavier metal, people use it to good effect on the likes of things like RPis as well. Sometimes CPU cycles is still the limiter or every last one is needed elsewhere. I also think it matters a lot less on spinning rust, where $/TB tends to be so much lower. How much one gets out of it also is influenced by application, general NAS with larger record size is going to see different gains vs a database. But with even vaguely modern desktop CPUs (and their surfeit of cores) and SSDs, particularly in network storage dedicated devices, an extra 10-30% even is worth a lot and there's usually plenty of CPU to throw at it. Even more so if primary usage is limited to only a 10-50 Gbps connection.

As always though probably best if you can benchmark it with your own stuff and play around a bit pulling different levers. ZFS is nice that way too since it's so easy to create a bunch of different test FS at the same time.

----

0: https://news.ycombinator.com/item?id=29268907

1: https://github.com/openzfs/zfs/pull/9735#issuecomment-570082...

Re: Zstandard RFC 8878

#39
post #6

Earlier quoted context omitted.

I assume it's because it's very new? That would seem like an obvious explanation.

zstd is from 2015.

I was talking about the RFC. You can't just shove any random compression into a browser even if it had existed for years, or can you?

Re: Zstandard RFC 8878

#40

Zstandard has very cool dictionary training feature, which allows to keep a separate dictionary and have a 50% ratio compression on very small (~100b) but repetitive data such as database records.

I've always thought it could be pretty cool to leverage that for transparent filesystem compression.

For context, filesystem compression usually compresses blocks of data individually (for instance, every 64K block of a file will be individually compressed, and when you modify a file in the middle, that block needs to be recompressed entirely). This is usually good enough, and it has some pretty cool properties, like being able to have only compressable parts of a file compressed, or turning on compression on a file and having only new and rewritten blocks get compressed. Because of Zstd's separated dictionary, it seems like it could be feasible to instead store the dictionary in the file's inode and compress the blocks with that dictionary (recomputing the dictionary and recompressing existing blocks when the file allocates 10 4K blocks and then again at 100 blocks, perhaps).

I wonder what different properties such a compression scheme would have. I imagine it would be able to achieve a much smaller size due to not having to store a dictionary with each compressed block. A downside would be that a corrupted or overwritten inode would render the file completely unrecoverable, where current compression schemes allow blocks to be individually decompressed. Another downside is that files can't be partially compressible, only entirely.

Post reply on HN