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

Fix builtin dockerfile frontend performance #2850

Merged
merged 2 commits into from
May 5, 2022

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented May 5, 2022

Dockerfile frontend makes many calls to BuildOpts() function
after named build context support was added. Previously it
only did one per build. The assumption is that BuildOpts()
is fast and does not need to be cached on the caller side.

In current implementation BuildOpts() listed the workers
in a way that triggered the platform emulation check to be
triggered to with could take 50-100ms to complete what adds
up if there are many Dockerfile stages.

This commit adds caching to BuildOpts. If frontend was
loaded through an external image then it was already cached
and this issue did not appear.

The second commit disables rechecking emulators in this case even for the first attempt. This was added in #1381 but I think rechecking it with every build is not needed. I made them in separate commits in case we only want to backport the first commit.

tonistiigi added 2 commits May 4, 2022 21:01
Dockerfile frontend makes many calls to BuildOpts() function
after named build context support was added. The assumption
is that BuildOpts() is fast and does not need to be cached on
the caller side.

In current implementation BuildOpts() listed the workers
in a way that triggered the platform emulation check to be
triggered to with could take 50-100ms to complete what adds
up if there are many Dockerfile stages.

This commit adds caching to BuildOpts. If frontend was
loaded through external image then it was already cached
and this issue did not appear.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
To reload emulators after they have been changed in the
kernel `ListWorkers` should be called.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi added this to the v0.10.3 milestone May 5, 2022
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backport both commits lgtm

@AkihiroSuda AkihiroSuda merged commit 8b8d004 into moby:master May 5, 2022
@tonistiigi
Copy link
Member Author

@AkihiroSuda You're also ok with backporting both or just the first commit?

@AkihiroSuda
Copy link
Member

Both seems fine, although just cherry-picking the first one might be safer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants