Increase gzip compression level to 9 (BestCompression) - #1082
lyoung-confluent wants to merge 2 commits into
Conversation
Signed-off-by: Luke Young <91491244+lyoung-confluent@users.noreply.github.com>
|
I think this would be great to add as an option/flag, but I'm reluctant to make it the default. We want building (and rebuilding) images to be fast during development so we can get a fast feedback loop. Since (Arguably, it might make more sense to have 9 be the default and have a flag to go faster during development...) I think klauspost's choice for default strikes a good balance (some older discussion here), but I also spent a month last year chasing performance as much as possible, so I might have gone a little too far :) Would you be okay with this as a flag? |
|
To win on both speed, and image size.... We should consider Zstd compression. But I have no idea if the ecosystem of where images are executed can support that. |
I feel like the major runtimes (containerd, mostly) probably already support zstd, but I'd be a little worried about things like Cloud Run. Would be worth experimenting with. |
|
@jonjohnsonjr whilst the ephemeral containers are indeed single use; the ones that are published for production; pulled thousands of times and deployed thousands of times - are not ephemeral. And there we do win from best compression once; and smaller transfer and faster uncompress on the other end. Also production images are often compared on compressed size. Thus improving this might be a win. |
|
possibly we would need to do dual publication of gzip + zstd like fedora is pushing https://discussion.fedoraproject.org/t/switch-fedora-container-images-to-support-zstd-chunked-format-by-default/123712/44 |
|
Closing per the 2024 discussion: the default stays as it is for build-loop speed, and the thread's direction moved to zstd. #2376 adds a |
Currently when building an image apko uses
pgzip.NewWriterwhich will use theDefaultCompressionconstant (-1) which is becomes a compression level of 5. We can decrease the final image/layer size at the cost of small amount of additional CPU during build time by instead opting into theBestCompressionlevel (9) viapgzip.NewWriterLevelinstead.This won't necessarily result in a huge change in image size for most images, for example using
examples/alpine-base.yamlit decreases from27691520bytes to26865152bytes (~3%).