Skip to content

Conversation

@Ferroin
Copy link
Member

@Ferroin Ferroin commented Nov 17, 2025

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 the data.tar file.

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.
@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Nov 17, 2025
@Ferroin Ferroin marked this pull request as ready for review November 18, 2025 13:23
@Ferroin Ferroin requested a review from vkalintiris as a code owner November 18, 2025 13:23
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@Ferroin Ferroin requested a review from a team December 1, 2025 13:12
Copy link
Contributor

@thiagoftsm thiagoftsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All debian packages created with this PR are installed with success. LGTM!
Updated: PR tested on Ubuntu 20.04.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Ferroin Ferroin merged commit 908e30b into netdata:master Dec 2, 2025
170 of 208 checks passed
@Ferroin Ferroin deleted the deb-compression branch December 2, 2025 11:51
@stelfrag stelfrag mentioned this pull request Dec 11, 2025
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/packaging Packaging and operating systems support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants