About the Benchmarking Process

What’s the difference between the four images?

In the benchmarking charts you’ll see four images: Few Large Layers, Few Small Layers, Many Large Layers, and Many Small Layers

All the images use the same base image: gcr.io/buildpacks/builder:v1

Few vs Many

Few will copy two files while many will copy 20 files.

Small vs Large

Small will copy a 20MB file while large will copy a 123MB file.

Using this info you can see the following:

  • Few Large Layers: copies two 123MB files
  • Few Small Layers: copies two 20MB files
  • Many Large Layers: copies 20 123MB files
  • Many Small Layers: copies 20 20MB files

Finally, as the last layer, a simplistic 11 line Go app is copied in.

Iterative vs Initial

There are two graphs for each benchmark, iterative and inital.

Inital

Initial simulates loading the image for the first time.

All existing images and cache is removed/cleared from minikube and Docker between runs to replicate what the user would experience when loading for the first time.

Iterative

Iterative simulates only the Go app (last layer of the image) changing.

This is the exact use case of Skaffold, where if the user changes a file the Go binary is rebuilt and the image is re-loaded.

Bewteen runs the cache and existing image is left alone, only the Go binary is changed.

How are the benchmarks conducted?

  1. // Pseudo code of running docker-env benchmark
  2. startMininkube() // minikube start --container-runtime=docker
  3. for image in [fewLargeLayers, fewSmallLayers, ...] {
  4. buildGoBinary()
  5. // inital simulation
  6. for i in runCount {
  7. startTimer()
  8. runDockerEnvImageLoad(image)
  9. stopTimer()
  10. verifyImageSuccessfullyLoaded()
  11. storeTimeTaken()
  12. removeImage()
  13. clearDockerCache()
  14. }
  15. // iterative simulation
  16. for i in runCount {
  17. updateGoBinary()
  18. startTimer()
  19. runDockerEnvImageLoad(image)
  20. stopTimer()
  21. verifyImageSuccessfullyLoaded()
  22. storeTimeTaken() // skip if first run
  23. }
  24. clearDockerCache()
  25. calculateAndRecordAverageTime()
  26. }
  27. deleteMinikube() // minkube delete --all

Last modified July 28, 2021: resolve change requests for #12040 (d1cdd24ef)