Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image efficiency scanning #8

Open
Temikus opened this issue Apr 26, 2020 · 3 comments
Open

Image efficiency scanning #8

Temikus opened this issue Apr 26, 2020 · 3 comments
Labels
A-build Area: CI build infrastructure. A-performance Area: Performance improvements and optimizations.

Comments

@Temikus
Copy link
Contributor

Temikus commented Apr 26, 2020

I believe it's worth it to make image efficiency scanning (e.g. dive) a step in CI to make sure we don't bloat the images later down the road.

WDYT?

@lopopolo
Copy link
Member

This looks cool. It's a benchmark of sorts. these types of tasks I've put in bench.yaml workflows and they do not block CI. I like running these checks and not blocking on them as a way to measure stats over time.

See https://github.com/artichoke/boba/blob/55124bf7d3e82ef274ceb6dbffe9e6a8a53adbc2/.github/workflows/bench.yaml for an example.

How does one fix a failed check here?

@lopopolo lopopolo added A-build Area: CI build infrastructure. A-performance Area: Performance improvements and optimizations. labels Apr 26, 2020
@Temikus
Copy link
Contributor Author

Temikus commented Apr 26, 2020

dive scans for inefficiencies by looking at whether the files get overwritten in multiple layers, wasting overall space.

It does give you a list of files to look at, e.g.:

λ dive --ci  haugene/transmission-openvpn
Using config file: /Users/temikus/.dive.yaml
  Using default CI config
Image Source: docker://haugene/transmission-openvpn
Fetching image... (this can take a while for large images)
Analyzing image...
  efficiency: 96.9607 %
  wastedBytes: 18154395 bytes (18 MB)
  userWastedPercent: 6.7145 %
Inefficient Files:
Count  Wasted Space  File Path
    2        3.2 MB  /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
    2        1.3 MB  /var/cache/debconf/templates.dat
    2        834 kB  /lib/x86_64-linux-gnu/libfdisk.so.1.1.0
    2        742 kB  /var/lib/dpkg/info/libstdc++6:amd64.symbols
    2        680 kB  /lib/x86_64-linux-gnu/libmount.so.1.1.0
    2        623 kB  /lib/x86_64-linux-gnu/libblkid.so.1.1.0
    2        562 kB  /var/cache/apt/pkgcache.bin
    2        484 kB  /var/log/dpkg.log
    2        425 kB  /var/cache/apt/srcpkgcache.bin
    2        392 kB  /lib/x86_64-linux-gnu/libsmartcols.so.1.1.0
    2        336 kB  /var/lib/dpkg/status
    2        296 kB  /var/log/lastlog
    2        250 kB  /sbin/fdisk
    2        217 kB  /sbin/sfdisk
    2        193 kB  /sbin/cfdisk
    2        193 kB  /lib/x86_64-linux-gnu/libgcc_s.so.1
    2        185 kB  /sbin/zramctl
    2        184 kB  /sbin/fsck.minix
    2        176 kB  /sbin/blkid
    2        176 kB  /usr/bin/partx
    2        168 kB  /sbin/losetup
    2        168 kB  /bin/lsblk
    2        160 kB  /sbin/mkfs.minix
    2        160 kB  /sbin/mkswap
    2        144 kB  /bin/dmesg
    2        144 kB  /usr/bin/lsipc
    2        144 kB  /usr/bin/lscpu
    2        136 kB  /usr/share/gcc-8/python/libstdcxx/v6/printers.py
    2        130 kB  /bin/findmnt
    2        128 kB  /usr/share/doc/gcc-8-base/copyright
    2        127 kB  /usr/bin/lslogins
 ...
    2           0 B  /usr/share/doc/mount/mount.txt
    2           0 B  /sbin/getty
    2           0 B  /usr/share/doc/util-linux/changelog.Debian.gz
    2           0 B  /usr/share/doc/fdisk/changelog.Debian.gz
Results:
  PASS: highestUserWastedPercent
  SKIP: highestWastedBytes: rule disabled
  PASS: lowestEfficiency
Result:PASS [Total:3] [Passed:2] [Failed:0] [Warn:0] [Skipped:1]

We can run it both as a benchmark and a gate (e.g. prevent us from wasting 50% image space or something high like that).

@lopopolo
Copy link
Member

Sounds great let's do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build Area: CI build infrastructure. A-performance Area: Performance improvements and optimizations.
Development

No branches or pull requests

2 participants