Drop Bootsnap stage and precompile all Ruby code
What does this MR do?
!1546 (merged)
introduced an additional build stage to generating the Bootsnap cache
for a standard GitLab startup using Docker Compose. However, we can
avoid this Docker Compose step if we simply compile all Ruby code
in /srv/gitlab
and use the --gemfile
Bootsnap argument
(https://github.com/Shopify/bootsnap/blob/master/README.md#precompilation).
While this increases the total size of the Bootsnap cache from 146 MB
to 234 MB, this guarantees that there will be no cache misses and
speeds up the build.
Boot time appears unaffected. It takes about 40 seconds to load webservice-ee
.
Relates to !1743 (merged)
Testing
I set BOOTSNAP_LOG: 1
in extraEnv
to monitor cache misses. I only saw one in webservice
and in sidekiq
:
[Bootsnap] miss /srv/gitlab/config/initializers/smtp_settings.rb
This makes sense because the SMTP settings are only rendered at the container start.
Sizes
Debian
Image | Size before (GB) | Size after (GB) |
---|---|---|
registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee | 2.05 | 2.05 |
registry.gitlab.com/gitlab-org/build/cng/gitlab-webservice-ee | 2.03 | 2.02 |
UBI-8
Image | Size before (GB) | Size after (GB) |
---|---|---|
registry.gitlab.com/gitlab-org/build/cng/gitlab-sidekiq-ee | 1.64 | 1.72 |
registry.gitlab.com/gitlab-org/build/cng/gitlab-webservice-ee | 1.6 | 1.68 |
Related issues
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion
Required
-
Merge Request Title, and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
When ready for review, MR is labeled "~workflow::ready for review" per the Distribution MR workflow
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Integration tests added to GitLab QA -
The impact any change in container size has should be evaluated -
New dependencies are managed with dependencies.io