-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Build] Improve docker build performance #11111
Conversation
what is the difference between this one with the SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD? |
... |
It uses different docker instances, the native docker uses the same docker instance started on the host. In the native docker mode, in the salve container, you can see everything the same as in the host. If multiple users use the same build system, they are sharing the same docker instance. We do not use the native docker in azp. In the salve container, we can see the container d48d9949fb53 itself, when native docker enabled.
|
I am wondering if you can keep vfs as the default option and add new option for this? i think the slave image is used in some other places. |
Yes, fixed. We can config the overlay2 option inside of the slave containers, not necessary to change in the slave image. |
@lguohan , do you have more comments? |
rules/config
Outdated
@@ -229,3 +229,6 @@ DEFAULT_CONTAINER_REGISTRY ?= | |||
# ENABLE_FIPS - support FIPS flag, if enabled, no additional config requred for the image to support FIPS | |||
ENABLE_FIPS_FEATURE ?= y | |||
ENABLE_FIPS ?= n | |||
|
|||
# SONIC_SLAVE_DOCKER_DRIVER - set the sonic slave docker storage driver | |||
SONIC_SLAVE_DOCKER_DRIVER ?= overlay2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to keep the default option as vfs, and we can experiment this overlay2 in our azure pipeline more before we change this option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense to only enable it in azp.
Fixed, thanks.
for reference, why we changed to vfs in the first place. #2016 |
Thanks for the info. It is true, the overlay fs cannot be used as backing filesystem of docker. If the source folder is an overlay fs, then it will be an issue, need to mount a non-overlay fs for the slave docker. In the azp agents, it should work fine. |
Why I did it The docker storage driver vfs is not a good option for build, it uses the “deep copy” when building a new layer, leads to lower performance and more space used on disk than other storage drivers. A better docker storage driver is the default one overlay2, it is a modern union filesystem.
This change assumes that all users building SONIC have password-less sudo access, which is not the case in our build environment. This is causing build problems for us. |
@jusherma , it was caused by the following line?
|
overlay2 is more faster comparing to vfs (more info in #11111) And we use this option to build SONiC almost two years. But it may be not obvious for some people that default choice is slow. I think we should set overlay2 as a default storage driver for DinD.
overlay2 is more faster comparing to vfs (more info in sonic-net#11111) And we use this option to build SONiC almost two years. But it may be not obvious for some people that default choice is slow. I think we should set overlay2 as a default storage driver for DinD.
Why I did it
The docker storage driver vfs is not a good option for build, it uses the “deep copy” when building a new layer, leads to lower performance and more space used on disk than other storage drivers.
A better docker storage driver is the default one overlay2, it is a modern union filesystem.
Reduce around 3 hours in Broadcom official build, from 12.5 hours to 9.5 hours.
Reduce from 1600G to 360G in Broadcom official build.
How I did it
How to verify it
Verify the build option:
For default option:
BLDENV=buster make -f Makefile.work docker-start KEEP_SLAVE_ON=yes
Enable overlay2:
SONIC_SLAVE_DOCKER_DRIVER=overlay2 BLDENV=buster make -f Makefile.work docker-start KEEP_SLAVE_ON=yes
Compare the disk write bytes metrics:
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)