Use improved compression algorithms when building DEB packages. - #21310
Merged
Conversation
XZ compression is the de-facto standard compression used for DEB packages on Ubuntu prior to Ubuntu 21.10 and Debian prior to Debian 12. Using XZ for DEB package compression incurs a nontrivial performance hit for the installation of the packages (specifically, the process of unpacking the packages), but provides a roughly 34% space savings for the whole collection of packages compared to our current usage of gzip compression (tested using Debian 13 packages) and unlike the newer zstd compression has been supported by dpkg for long enough that we don’t really have to worry about any given system not supporting it.
Zstd compression is supported, and used by default, in Debian and Ubuntu starting with Debian 12 and Ubuntu 21.10. Compared to gzip compression, zstd provides a roughly 8.6% reduction in the total size of a full set of our packages (tested using Debian 13 packages), while at the same time reducing the overhead of unpacking the package for installation. Compared to the XZ compression that the previous commit enabled by default for our packages, zstd results in roughly 38% larger packages, but it completely removes the overhead on installation that XZ imposes, and is thus generally considered enough of a net improvement that both Debian and Ubuntu have pivoted from using XZ for package compression for their distribution packages to using zstd.
Ferroin
marked this pull request as ready for review
November 18, 2025 13:23
thiagoftsm
approved these changes
Dec 2, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates DEB package compression from gzip to more efficient algorithms, improving space efficiency while maintaining compatibility with target distributions.
Key Changes:
- Sets XZ as the default compression algorithm for DEB packages (34.2% space savings)
- Implements runtime detection of OS distribution and version via
/etc/os-release - Uses zstd compression for Debian 12+ and Ubuntu 21.10+ (8.6% space savings with better decompression performance)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
stelfrag
pushed a commit
to stelfrag/netdata
that referenced
this pull request
Dec 11, 2025
…ata#21310) * Switch to XZ compression by default for DEB packages. XZ compression is the de-facto standard compression used for DEB packages on Ubuntu prior to Ubuntu 21.10 and Debian prior to Debian 12. Using XZ for DEB package compression incurs a nontrivial performance hit for the installation of the packages (specifically, the process of unpacking the packages), but provides a roughly 34% space savings for the whole collection of packages compared to our current usage of gzip compression (tested using Debian 13 packages) and unlike the newer zstd compression has been supported by dpkg for long enough that we don’t really have to worry about any given system not supporting it. * Enable zstd compression for DEB packages on platforms that support it. Zstd compression is supported, and used by default, in Debian and Ubuntu starting with Debian 12 and Ubuntu 21.10. Compared to gzip compression, zstd provides a roughly 8.6% reduction in the total size of a full set of our packages (tested using Debian 13 packages), while at the same time reducing the overhead of unpacking the package for installation. Compared to the XZ compression that the previous commit enabled by default for our packages, zstd results in roughly 38% larger packages, but it completely removes the overhead on installation that XZ imposes, and is thus generally considered enough of a net improvement that both Debian and Ubuntu have pivoted from using XZ for package compression for their distribution packages to using zstd. (cherry picked from commit 908e30b)
Ferroin
added a commit
that referenced
this pull request
Dec 15, 2025
* Switch to XZ compression by default for DEB packages. XZ compression is the de-facto standard compression used for DEB packages on Ubuntu prior to Ubuntu 21.10 and Debian prior to Debian 12. Using XZ for DEB package compression incurs a nontrivial performance hit for the installation of the packages (specifically, the process of unpacking the packages), but provides a roughly 34% space savings for the whole collection of packages compared to our current usage of gzip compression (tested using Debian 13 packages) and unlike the newer zstd compression has been supported by dpkg for long enough that we don’t really have to worry about any given system not supporting it. * Enable zstd compression for DEB packages on platforms that support it. Zstd compression is supported, and used by default, in Debian and Ubuntu starting with Debian 12 and Ubuntu 21.10. Compared to gzip compression, zstd provides a roughly 8.6% reduction in the total size of a full set of our packages (tested using Debian 13 packages), while at the same time reducing the overhead of unpacking the package for installation. Compared to the XZ compression that the previous commit enabled by default for our packages, zstd results in roughly 38% larger packages, but it completely removes the overhead on installation that XZ imposes, and is thus generally considered enough of a net improvement that both Debian and Ubuntu have pivoted from using XZ for package compression for their distribution packages to using zstd. (cherry picked from commit 908e30b)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates our DEB package builds to utilize either XZ or zstd compression instead of the gzip compression we are currently using.
For Debian 12 and newer, and Ubuntu 21.10 and newer, we now use zstd for compression, which is consistent with what those distros use for their repository packages. This provides a roughly 8.6% space savings for a full collection of our packages in comparison to our existing gzip compression (tested using Debian 13 packages), as well as providing a slight reduction in decompression overhead when unpacking the packages.
For older versions of Debian and Ubuntu, we now use XZ for compression, which is also consistent with what those distros use for their repository packages. This provides an absolutely absurd 34.2% space savings for a full collection of our packages in comparison to our existing gzip compression (again, tested using Debian 13 packages), but at the cost of imposing a significantly higher decompression overhead when unpacking the packages.
Test Plan
Requires manual cross-checking to confirm that packages are being built with the new compression methods.
Compression of DEB packages can be checked by mounting the package file with
archivemount(available in almost all distro’s official repositories via a package of the same name) and inspecting the extension of thedata.tarfile.