Skip to content

Make cache use zstd compression#530

Open
bertptrs wants to merge 2 commits intosemaphoreci:masterfrom
channable:bp/zstd-caching
Open

Make cache use zstd compression#530
bertptrs wants to merge 2 commits intosemaphoreci:masterfrom
channable:bp/zstd-caching

Conversation

@bertptrs
Copy link

Update the cache command to create Zstd-compressed archives rather than gzip-compressed. In testing, this reduces archive size by 20%, with proportional gains in download times, as well as a 50% reduction in decompression time.

This change is backwards-compatible and can handle existing, gzip-compressed archives without changes. To do this, we attempt to see if the file is valid Zstd. For the shell-out archiver, I opted to let tar's built-in autodetection handle the differentiation. This works on all tested systems.

Tested manually on Semaphore Linux- and MacOS cloud runners. Timing improvements measured on our own hardware as Semaphore runners appear to be I/O bound.

Fixes #523. In the future, you might want to delete the old gzip implementation as it's messy.

The cache command will now create zstd-compressed archives. When
decompressing, it attempts to compress as Zstd first, but if the magic
bytes do not match, it falls back to gzip compression.
@bertptrs
Copy link
Author

Note that the Go zstd implementation is not particularly fast, so the shell-out archiver becomes faster than the native-parallel archiver with this change. What to do with this is an exercise to the reader. It still beats gzip regardless.

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.

Change default compression algorithm for cache from gzip to Zstd

1 participant