ワンクリックで
benchmark-packing
// Benchmark chunkah packing algorithm changes against a series of OCI images.
// Benchmark chunkah packing algorithm changes against a series of OCI images.
Use when you need to measure per-phase memory allocation statistics to investigate memory usage.
Use when you need to extract an OCI archive to inspect its contents, get the rootfs layer, or read the image config.
| name | benchmark-packing |
| description | Benchmark chunkah packing algorithm changes against a series of OCI images. |
This skill guides benchmarking of packing algorithm changes by chunking a series of consecutive OCI images and measuring layer reuse between them. The key tools are:
tools/chunk-image-series.py -- chunks a series of imagestools/analyze-layer-reuse.py -- compares layer sharing across
the chunked seriesAfter making code changes, build the container image:
just buildimg --no-chunk
This produces localhost/chunkah:latest.
Source images must be in containers-storage. Either:
From OCI archives:
for archive in /path/to/*.ociarchive; do
version=$(echo "${archive}" | grep -oP 'PATTERN')
skopeo copy "oci-archive:${archive}" "containers-storage:localhost/myrepo:${version}"
done
From a registry:
chunk-image-series.py can pull directly from a registry:
tools/chunk-image-series.py docker://quay.io/fedora/fedora-coreos \
--tag-filter '43.*' --limit 10 ...
tools/chunk-image-series.py containers-storage:localhost/myrepo \
--tag-filter '43.*' \
--prefix myrepo-chunked \
--chunkah-image localhost/chunkah \
--force \
-- --prune /sysroot --max-layers 128
Key flags:
--force to overwrite results from prior runs--limit N to control how many images to process--Pass all chunked images as separate positional arguments:
image_args=()
for i in $(seq 0 9); do
image_args+=("containers-storage:localhost/myrepo-chunked:${i}")
done
tools/analyze-layer-reuse.py --json "${image_args[@]}" > results.json
IMPORTANT: do NOT use brace expansion inside quotes (e.g.
"...:{0,1,2}") -- it won't expand. Always build the argument
list explicitly.
The JSON summary fields are:
avg_reuse_ratio -- fraction of data shared (0.0 to 1.0)avg_download_bytes -- average new data per updateAlways clean up chunked images after capturing results:
for i in $(seq 0 9); do
podman rmi "localhost/myrepo-chunked:${i}" 2>/dev/null || true
done
Always measure the original (un-chunked) images as a baseline:
image_args=()
for tag in $(podman images --filter reference='localhost/myrepo' \
--format '{{.Tag}}' | sort); do
image_args+=("containers-storage:localhost/myrepo:${tag}")
done
tools/analyze-layer-reuse.py --json "${image_args[@]}" > original.json
To compare a code change against the current defaults:
quay.io/coreos/chunkah:dev)localhost/chunkahThe source images and original baseline can be reused across runs.
chunk-image-series.py creates temporary localhost/tmp-chunk-src
tags during chunking. These are cleaned up on exit, but if a prior
run was interrupted, stale tags may remain and cause duplicate
entries. Before running analysis, verify tags are clean:
podman images --filter reference='localhost/myrepo' --format '{{.Tag}}' | sort
If you see duplicate tags, remove them before proceeding. A red
flag in results is min_download_bytes: 0 -- this means two
consecutive images were identical (likely duplicates).
Results can vary significantly depending on the specific time window of builds tested. Always test against multiple independent corpora (e.g. different image types, different time periods) before concluding a change is beneficial. An improvement on one sample may not generalize.
The default --max-layers is 64. Results at 64 layers vs 128
layers can differ substantially. Always compare configurations at
the same layer count.