diff options
author | Vincent Ambo <tazjin@google.com> | 2019-10-03T19·18+0100 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2019-10-03T21·50+0100 |
commit | 48a5ecda97e4b2ea9faa2d3031376078ccc301be (patch) | |
tree | 1ce8ab5c6fbe5c653115d30846276013b32f9501 /tools/nixery/server/builder/builder.go | |
parent | 0d820423e973727ddfc4b461a1063f719873743c (diff) |
feat(server): Order layers in image manifest based on merge rating
Image layers in manifests are now sorted in a stable (descending) order based on their merge rating, meaning that layers more likely to be shared between images come first. The reason for this change is Docker's handling of image layers on overlayfs2: Images are condensed into a single representation on disk after downloading. Due to this Docker will constantly redownload all layers that are applied in a different order in different images (layer order matters in imperatively created images), based on something it calls the 'ChainID'. Sorting the layers this way raises the likelihood of a long chain of matching layers at the beginning of an image. This relates to #39.
Diffstat (limited to 'tools/nixery/server/builder/builder.go')
-rw-r--r-- | tools/nixery/server/builder/builder.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/nixery/server/builder/builder.go b/tools/nixery/server/builder/builder.go index d8cbbb8f21c9..614291e660c5 100644 --- a/tools/nixery/server/builder/builder.go +++ b/tools/nixery/server/builder/builder.go @@ -250,6 +250,7 @@ func prepareLayers(ctx context.Context, s *State, image *Image, result *ImageRes if err != nil { return nil, err } + entry.MergeRating = l.MergeRating go cacheLayer(ctx, s, l.Hash(), *entry) entries = append(entries, *entry) |