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

Some operations are hindering parallelism #888

Closed
flupke opened this issue Mar 24, 2021 · 4 comments · Fixed by #894
Closed

Some operations are hindering parallelism #888

flupke opened this issue Mar 24, 2021 · 4 comments · Fixed by #894
Labels
type:proposal A proposal for a new feature

Comments

@flupke
Copy link

flupke commented Mar 24, 2021

It seems that FROM DOCKERFILE creates synchronisation points in the build graph:

FROM alpine:latest

a:
    RUN echo -e "FROM alpine:latest\nRUN sleep 4\n" > Dockerfile
    RUN sleep 5
    SAVE ARTIFACT Dockerfile

b:
    RUN echo -e "FROM alpine:latest\nRUN sleep 5\n" > Dockerfile
    RUN sleep 5
    SAVE ARTIFACT Dockerfile

a-child:
    FROM DOCKERFILE +a/
    RUN echo "A done"

b-child:
    FROM DOCKERFILE +b/
    RUN echo "B done"

all:
    BUILD +a-child
    BUILD +b-child

Here is what happens when trying to build this:
asciicast

Building a similar graph without FROM DOCKERFILE or with locally referenced Dockerfile executes +a and +b in parallel.

Note: I had to do earthly prune because --no-cache didn't prevent the *cached* steps, is this normal? (using earthly v0.5.7)

@flupke flupke changed the title FROM DOCKERFILE seems to hinder parallelism? FROM DOCKERFILE in combination with SAVE ARTIFACT seems to hinder parallelism? Mar 24, 2021
@vladaionescu
Copy link
Member

Hi @flupke - you're right. This is a limitation in our current implementation. It affects WITH DOCKER --load, WITH DOCKER --pull, FROM DOCKERFILE <target>, IF and non-constant args: ARG X=$(...) and --build-arg X=$(...).

Technical explanation: buildkit takes care of parallelism for the most part, however, some Earthfile operations need to inquire about the result of a previous operation before being able to continue. This takes place in the Earthfile->LLB conversion process. Currently, this conversion process is single-threaded, so situations like you're demoing here make this bottleneck obvious.

We've been thinking of switching the conversion process to be parallel too but haven't yet gotten around to it. I'll use this issue as a tracking issue.

Note: I had to do earthly prune because --no-cache didn't prevent the cached steps, is this normal? (using earthly v0.5.7)

I believe this is just a visual glitch. Mind opening a separate issue for this?

@vladaionescu vladaionescu changed the title FROM DOCKERFILE in combination with SAVE ARTIFACT seems to hinder parallelism? Some operations are hindering parallelism Mar 24, 2021
@vladaionescu vladaionescu added the type:proposal A proposal for a new feature label Mar 24, 2021
@flupke
Copy link
Author

flupke commented Mar 24, 2021

I believe this is just a visual glitch. Mind opening a separate issue for this?

Sure! #889

BTW thank you very much for the awesome support and product, Earthly is amazing ❤️

@vladaionescu
Copy link
Member

Note that there are some known issues with this feature:

  • Random context deadline exceeded returned by buildkit for large builds, or for moderately-sized builds running on underpowered or virtualized setups (e.g. Mac, Windows).

Will keep this open until known issues are addressed.

@vladaionescu
Copy link
Member

To enable this Beta feature set export EARTHLY_CONVERSION_PARALLELISM=5 before running Earthly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:proposal A proposal for a new feature
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants