-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Please provide a way to limit parallelism in Compose v2 #8849
Comments
Confer buildkit #1032 → new setting MaxParallelism (only on daemon start). I guess unless buildkit #593 or buildkit #1131 are addressed, it seems to be a "won't fix". |
Well, for the building part of it sure, but compose can independently provide a parallelism limit for container operations which is mostly what this issue is about as opposed to building. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Issue is not stale. |
This issue has been automatically marked as not stale anymore due to the recent activity. |
We could use this as well. We have a docker compose file with 11 services. If all containers need to build first, 11 builds will try to do a "nuget restore" at the same time. This takes so much bandwidth at the same time that many of them run into timeout problems and fail. The only and really annoying workaround I found is to manually comment out some of the services in my docker compose and build that first, so that not all of them are built at the same time. |
An easier workaround that doesn't involve modifying your compose file is to use yq and xargs:
If you want to, replace the |
This issue is probably also related: #9837 |
This issue is/was supposed to be specifically about limiting parallelism for container operations not build operations. I suspect these are two totally different implementations since when limiting it for container operations things like dependencies on other defined services need to be taken into account. As has been shown with the |
Ran into this one again... you would expect at least a reaction from the docker people at least... |
this is (partially) addressed by #10030 |
I'll close this issue, considered as fixed by #10030 while we are aware this doesn't include support for |
@ndeloof can you please reopen this issue? This issue is not about pulls, pushes, or builds, it's about the spawning of containers when using Perhaps the issue title is too generic but the issue description is explicit about using |
If your application involves 50 containers, what do you expect but 50 containers starting? |
@ndeloof See my report for v1 with the same issue - #8226 When asked to start a large number of containers (let's keep using 50 as the example) compose appears to be sending 50 parallel API requests to docker to start containers. With the patch in the linked issue (by a third party that was never merged) that actually limits the parallelism of these calls, compose works far, far, better for large numbers of containers as it starts the 50 but with only X number of API calls in parallel. This means the run on system resources completely goes away. Of course we want the 50 containers to start, just not with a parallelism of 50. |
Due to #8530 we will have to limit parallelism on ContainerCreate anyway |
I see - might it be nice to leave this issue open regardless? For example if the patch for #8530 ends up checking for port ranges and only making calls sequential if they exist, then it would still be good to have an option to manually turn on sequential container creation. There's a chance that some people not using port ranges will want the max parallel container creation so that would appease both sides if implemented in this way. Also looking at the merged changes for #10030 - it might be good to adjust the help text to clarify exactly what it is limiting the parallelism of. Right now it reads like it affects all operations. |
Yes, need to apply the same in a few other places (everywhere we don't call non-trivial APIs) |
Being able to limit parallel startup sounds interesting. For low-memory devices (talking about 512MB or 1GB RAM), I've noticed the container startup in parallel causes a spike in RAM usage that leads to some containers being created but not started, for instance. Being able to limit parallel container startup might make it possible to overcome such a limitation. |
with latest codebase, container start takes place sequentially, not concurrently anymore. Please note anyway this is about calling engine's |
This is actually a problem on low resource devices like raspberry pi 4. I have a 8GB model, and need to run 4 docker compose files on boot. On boot when the docker service starts, all the services compete for resources, although I have enough ram, the containers get starved for CPU resources which results in a kernel panic and raspberry pi crashes. Here clearly if I can start the compose files in a staggered manner, it would totally prevent this. |
@varishtsg have you tried setting COMPOSE _PARALLEL_LIMIT in your startup script? |
So, there's no way to limit the parallelism when using docker compose up? |
i saw a similar comand up, but it didnt work.
|
Description
This issue is a report/feature request for Compose v2 but is essentially the same as this problem in v1 - #8226
Having no limit to parallelism makes compose effectively unusable when the compose file contains more than a few dozen services, as it consumes all resources on the host system when doing operations like bringing containers up.
Currently we have no way to migrate to compose v2 because of this and indeed we are stuck on v1 with a third party patch.
Please provide a way to limit parallelism.
Steps to reproduce the issue:
docker compose up -d --remove-orphans
(or equivalent)Describe the results you received:
As above.
Describe the results you expected:
As above, since there is no way to limit parallelism.
Additional information you deem important (e.g. issue happens only occasionally):
N/A
Output of
docker compose version
:Output of
docker info
:Additional environment details:
The text was updated successfully, but these errors were encountered: