From b0d5b85a47a8daaa68ebd6b246cfb3b4d9173970 Mon Sep 17 00:00:00 2001 From: Josh Friend Date: Tue, 5 May 2026 16:37:58 -0700 Subject: [PATCH] perf: use pzstd for snapshot compression Switch from zstd to pzstd for snapshot archival. pzstd produces multiple independent zstd frames that clients can decompress in parallel. The output is a valid zstd stream readable by any standard zstd decoder. --- client/archive.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/archive.go b/client/archive.go index c392aea..a4d196f 100644 --- a/client/archive.go +++ b/client/archive.go @@ -103,11 +103,11 @@ func Extract(ctx context.Context, r io.Reader, directory string, threads int) er return errors.Join(errs...) } -// runTarZstdPipeline runs tar piped through zstd, writing compressed output +// runTarZstdPipeline runs tar piped through pzstd, writing compressed output // to w. The caller is responsible for closing w after this returns. func runTarZstdPipeline(ctx context.Context, tarArgs []string, threads int, w io.Writer) error { tarCmd := exec.CommandContext(ctx, "tar", tarArgs...) - zstdCmd := exec.CommandContext(ctx, "zstd", "-c", fmt.Sprintf("-T%d", threads)) //nolint:gosec + zstdCmd := exec.CommandContext(ctx, "pzstd", "-c", fmt.Sprintf("-p%d", threads)) //nolint:gosec // Manual pipe so we can close both ends in the parent after starting // children. Prevents deadlock if zstd exits while tar is still writing: