Heuristic:Vespa engine Vespa RPM Zstd Compression Settings
| Knowledge Sources | |
|---|---|
| Domains | Optimization, Build_System |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
RPM packaging optimization using zstd compression (w10T4.zstdio), disabled jar repacking, disabled LTO, and stripped debug info for faster builds.
Description
The Vespa RPM build process uses several packaging optimizations to reduce build time while maintaining acceptable package sizes. The binary payload uses zstandard compression at level 10 with 4-thread parallelism. Several standard RPM post-processing steps are disabled: jar repacking (expensive and unnecessary), Link-Time Optimization, hardened build flags, and RPATH checks (Vespa uses custom library paths in /opt/vespa/lib64).
Usage
Apply this heuristic when building Vespa RPM packages or when configuring rpmbuild for large C++/Java projects. The settings are tuned for the Vespa build pipeline where build speed is prioritized over maximum compression ratio.
The Insight (Rule of Thumb)
- Action 1: Set binary payload compression to
w10T4.zstdio(zstd level 10, 4 threads). - Action 2: Disable jar repacking:
%define __jar_repack %{nil}(comment: "Hack to speed up jar packing for now"). - Action 3: Disable LTO:
%global _lto_cflags %{nil}. - Action 4: Disable hardened build:
%undefine _hardened_build. - Action 5: Disable RPATH checks:
%global __brp_check_rpaths %{nil}. - Action 6: Strip debug info only (not full strip):
%global _find_debuginfo_opts -g. - Trade-off: Faster builds at cost of slightly larger packages and less security hardening.
Reasoning
Jar repacking is one of the most time-consuming post-processing steps and provides minimal benefit for Vespa's use case. LTO would increase binary size analysis time without significant runtime benefit for the Vespa deployment model. Hardened build flags (ASLR, stack canaries) are disabled because Vespa manages its own security boundaries. RPATH checks would fail because Vespa intentionally uses libraries in /opt/vespa/lib64 and /opt/vespa-deps/lib64. The zstd level 10 with 4 threads provides good compression while leveraging multi-core for speed.
Code Evidence
Compression setting from build-rpms.sh:22-26:
rpmbuild --rebuild \
--define="_topdir $WORKDIR/vespa-rpmbuild" \
--define="_debugsource_template %{nil}" \
--define="_binary_payload w10T4.zstdio" \
--define "installdir $WORKDIR/vespa-install"
Jar repacking disabled from dist/vespa.spec:
# Hack to speed up jar packing for now
%define __jar_repack %{nil}
LTO disabled from dist/vespa.spec:
# Don't enable LTO
%global _lto_cflags %{nil}
Hardened build disabled from dist/vespa.spec:
%undefine _hardened_build
%global _preprocessor_defines %{nil}