|
| 1 | +--- |
| 2 | +title: "About the Benchmarking Process" |
| 3 | +linkTitle: "About the Benchmarking Process" |
| 4 | +weight: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +## What's the difference between the four images? |
| 8 | +In the benchmarking charts you'll see four images: Few Large Layers, Few Small Layers, Many Large Layers, and Many Small Layers |
| 9 | + |
| 10 | +All the images use the same base image: `gcr.io/buildpacks/builder:v1` |
| 11 | + |
| 12 | +#### Few vs Many |
| 13 | +Few will copy two files while many will copy 20 files. |
| 14 | + |
| 15 | +#### Small vs Large |
| 16 | +Small will copy a 20MB file while large will copy a 123MB file. |
| 17 | + |
| 18 | +Using this info you can see the following: |
| 19 | +- Few Large Layers: copies two 123MB files |
| 20 | +- Few Small Layers: copies two 20MB files |
| 21 | +- Many Large Layers: copies 20 123MB files |
| 22 | +- Many Small Layers: copies 20 20MB files |
| 23 | + |
| 24 | +Finally, as the last layer, a simplistic 11 line Go app is copied in. |
| 25 | + |
| 26 | +## Iterative vs Initial |
| 27 | +There are two graphs for each benchmark, iterative and inital. |
| 28 | + |
| 29 | +#### Inital |
| 30 | +Initial simulates loading the image for the first time. |
| 31 | + |
| 32 | +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. |
| 33 | + |
| 34 | +#### Iterative |
| 35 | +Iterative simulates only the Go app (last layer of the image) changing. |
| 36 | + |
| 37 | +This is the exact use case of [Skaffold](https://github.com/GoogleContainerTools/skaffold), where if the user changes a file the Go binary is rebuilt and the image is re-loaded. |
| 38 | + |
| 39 | +Bewteen runs the cache and existing image is left alone, only the Go binary is changed. |
| 40 | + |
| 41 | + |
| 42 | +## How are the benchmarks conducted? |
| 43 | +``` |
| 44 | +// Pseudo code of running docker-env benchmark |
| 45 | +
|
| 46 | +startMininkube() // minikube start --container-runtime=docker |
| 47 | +
|
| 48 | +for image in [fewLargeLayers, fewSmallLayers, ...] { |
| 49 | + buildGoBinary() |
| 50 | +
|
| 51 | + // inital simulation |
| 52 | + for i in runCount { |
| 53 | + startTimer() |
| 54 | +
|
| 55 | + runDockerEnvImageLoad(image) |
| 56 | +
|
| 57 | + stopTimer() |
| 58 | +
|
| 59 | + verifyImageSuccessfullyLoaded() |
| 60 | +
|
| 61 | + storeTimeTaken() |
| 62 | +
|
| 63 | + removeImage() |
| 64 | +
|
| 65 | + clearDockerCache() |
| 66 | + } |
| 67 | +
|
| 68 | + // iterative simulation |
| 69 | + for i in runCount { |
| 70 | + updateGoBinary() |
| 71 | +
|
| 72 | + startTimer() |
| 73 | +
|
| 74 | + runDockerEnvImageLoad(image) |
| 75 | +
|
| 76 | + stopTimer() |
| 77 | +
|
| 78 | + verifyImageSuccessfullyLoaded() |
| 79 | +
|
| 80 | + storeTimeTaken() // skip if first run |
| 81 | + } |
| 82 | +
|
| 83 | + clearDockerCache() |
| 84 | +
|
| 85 | + calculateAndRecordAverageTime() |
| 86 | +} |
| 87 | +
|
| 88 | +deleteMinikube() // minkube delete --all |
| 89 | +``` |
0 commit comments