Skip to content

Instantly share code, notes, and snippets.

@bogdando
Last active November 7, 2019 12:00
Show Gist options
  • Save bogdando/31b01500878acec8a32aba20c640cc60 to your computer and use it in GitHub Desktop.
Save bogdando/31b01500878acec8a32aba20c640cc60 to your computer and use it in GitHub Desktop.
#!/bin/bash
printf 'Total layers/blobs involved into the test 8787(l)/5000(l+b): '
find /var/lib/image-serve/v2 -type f -name 'sha256*' | cut -d':' -f2 | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -type f | cut -d'/' -f17 | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/blobs -type f | wc -l
printf 'Total unique layers 8787/5000: '
find /var/lib/image-serve/v2 -type f -name 'sha256*' | cut -d':' -f2 | sort -u | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -type f | cut -d'/' -f17 | sort -u | wc -l
printf 'Total linked layers 8787: '
find /var/lib/image-serve/v2 -type f -links +1 -name 'sha256*' | cut -d':' -f2 | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -links +1 | cut -d'/' -f17 | wc -l
printf 'Total linked and unique 8787: '
find /var/lib/image-serve/v2 -type f -links +1 -name 'sha256*' | cut -d':' -f2 | sort -u | wc -l
find /var/lib/containers/storage/volumes/*/_data/docker/registry/v2/repositories/*/*/_layers/sha256 -links +1 | cut -d'/' -f17 | sort -u | wc -l
[ "$1" ] || exit 0
echo
printf 'Starting new HTTP: '
grep 'Starting new HTTP' $1 | wc -l
printf 'Connecting docker.io: '
grep docker.io $1 | wc -l
printf 'Layer already exists (checked via HTTP): '
grep 'already exists:' $1 | wc -l
printf 'Layer already exists (in cached view): '
grep 'already exists at' $1 | wc -l
printf 'Layer referenced by other images (in cached view): '
grep 'by image' $1 | wc -l
printf 'Cross repo mounts: '
grep 'Cross' $1 | wc -l
printf 'Linking layers: '
grep 'Linking layers' $1 | wc -l
printf 'Locks being fetched by another worker: '
grep 'being fetched by another' $1 | wc -l
printf 'No lock information provided: '
grep 'No lock information provided' $1 | wc -l
printf 'Lock collisions: '
grep ollision $1 | wc -l
printf 'layers re-read via HTTP: '
grep -Eo '((Read|Fetching).*sha256:\S+)' $1 > /tmp/all
diff -Nuar <(cat /tmp/all | sed -r 's/.*sha256:(\S+).*/\1 \0/' | sort -u) <(cat /tmp/all | sed -r 's/.*sha256:(\S+).*/\1 \0/' | sort) | grep -E '^\+{1,}' | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment