Skip to content

[RAWL-3481] Use 8 zstd workers and compression level 3 for create-layer#122

Merged
The-Cop merged 1 commit into
mainfrom
the-cop/zstd-configurable-workers
Apr 30, 2026
Merged

[RAWL-3481] Use 8 zstd workers and compression level 3 for create-layer#122
The-Cop merged 1 commit into
mainfrom
the-cop/zstd-configurable-workers

Conversation

@The-Cop
Copy link
Copy Markdown
Contributor

@The-Cop The-Cop commented Apr 14, 2026

Summary

  • Hardcodes 8 zstd worker threads for parallel compression, improving throughput
  • Sets zstd compression level to 3 (from default 5) — ~20-40% faster with only ~2% larger images, still ~17% smaller than gzip (comparison)
  • Flushes the zstd writer after each file to bound memory usage — without this, multi-threaded zstd buffers input asynchronously and memory can grow to the full uncompressed layer size
  • Declares cpu:8 execution requirement on zstd layer actions in Bazel so the scheduler reserves cores accordingly

@The-Cop The-Cop requested a review from bcmyers April 14, 2026 10:28
@The-Cop The-Cop marked this pull request as ready for review April 14, 2026 10:29
@The-Cop The-Cop marked this pull request as draft April 17, 2026 08:28
@The-Cop The-Cop force-pushed the the-cop/zstd-configurable-workers branch from a9dccc9 to f050f09 Compare April 17, 2026 10:38
Flush zstd writer between files to bound memory with multi-threaded compression.

Without periodic flushes, multi-threaded zstd buffers input
asynchronously, causing memory usage to grow up to the full
uncompressed layer size.

Declare cpu:8 execution_requirements for zstd OCI layer actions.

ocitool create-layer spawns 8 zstd worker threads internally. Without
declaring this cost, Bazel over-subscribes the machine by scheduling
too many concurrent zstd layer builds. Add conditional
execution_requirements so Bazel's scheduler accounts for the actual
CPU usage (8 for zstd, default 1 for gzip).
@The-Cop The-Cop force-pushed the the-cop/zstd-configurable-workers branch from f050f09 to 17e8031 Compare April 17, 2026 11:17
@The-Cop The-Cop changed the title Add --zstd-workers flag to create-layer command Use 8 zstd workers and compression level 3 for create-layer Apr 17, 2026
@The-Cop The-Cop marked this pull request as ready for review April 17, 2026 13:31
@The-Cop The-Cop changed the title Use 8 zstd workers and compression level 3 for create-layer [RAWL-3481] Use 8 zstd workers and compression level 3 for create-layer Apr 17, 2026
@The-Cop The-Cop merged commit 1273a69 into main Apr 30, 2026
2 checks passed
@The-Cop The-Cop deleted the the-cop/zstd-configurable-workers branch April 30, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants