-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
add --parallel option to build #6115
Conversation
Please sign your commits following these rules: $ git clone -b "parallel-build" git@github.com:graphaelli/compose.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
Signed-off-by: Gil Raphaelli <g@raphaelli.com>
Thank you for your submission! I think we need to proceed with caution here, because even if this is just an option, it can absolutely be detrimental to the general user experience if parallel builds are slower in a majority of cases - which moby/moby#9656 seems to indicate (and I have no reason to believe it was magically fixed without anyone noticing). Notably, the test you added doesn't include a significant build context, which seems to be important in reproducing the bug. |
@shin- That sounds fair, what are reasonable parameters to work with? moby/moby#9656 (comment) uses a 400M context. On my machine (18.06.0-ce / 0ffa825 on a mac) results in:
|
I mostly want to check in with the engine maintainers to get their thoughts on the issue's status and how this may interact with the buildkit integration. I'll update once I have more info! |
Perhaps it would be good to have Having said that, I think the benefits would highly depend on how the builds relate to each other, and what happens during those builds; with buildkit integration, the context will be streamed to the daemon, and will be cached, so a second run of a build will only stream changes to the daemon. In a situation where multiple builds use the same build-context (I think) running them in parallel will be less performant in the end, as the same build-context will be uploaded to the daemon twice (in parallel) whereas sequential builds would re-use the same uploaded context (only sending changes since the last build). @tonistiigi and @AkihiroSuda are really the experts in this area though 👍 |
@thaJeztah I'd prefer |
In Buildkit this can just be turned on always. No need for a flag.
In some BuildKit benchmarks I remember seeing a while back it really didn't make sense on limiting it (unless cpu is 100% but the user can't predict that). Only in some very high numbers the benefits on parallelization started to become meaningless.
BuildKit does support reusing the context for multiple requests through API. Just needs some work that does a single session request and multiple build requests referencing the session. Until compose sends a tarball of the context and doesn't use the session API it will not benefit of the incremental changes anyway. |
In that case hard coding seems fine, it's currently 5 - any reason to change that now? @shin- Anything else to clear up before merging this? |
I'm fine with the current limit of 5 - we can adjust later based on user feedback if necessary. Other than that, LGTM. |
5 is too low since we now have access to 32 cores Threadripper 2990WX in mainstream. Would be nice to make it to accept a number. |
What about adding this to |
I see this is merged? is this in latest compose? |
It's not in a released version yet, looks like it will be in 1.23 though it's not specifically mentioned in the release notes. |
Sorry I let it slip from the release notes! Will make sure it's fixed in the upcoming one. |
@shin- one of the best things after a long time!!! Thank you!!! Building multiple apps in parallel is now just a piece of cake!!! Wow, super fast! |
Is there a way to pass the |
When are the apt repositories gonna be updated with latest docker-compose? It seems that apt still installs 1.17 |
Would it be possible to add an environment variable to support building in parallel as well? We currently use a Docker Compose project in Visual Studio and it doesn't support passing command line args to compose. It would be nice if we could just set an environment variable and have it default to always build in parallel. |
#1652 added parallelism to a number of compose actions.
build
was left out because of moby/moby#9656.That doesn't seem to be an issue any more, at least in some cases. For example, adding
sleep 5
to the two services introduced in this change results in:sequential build:
parallel build:
Testing on a real set of services reveals similar results.
Resolves #5158