Rails: bootsnap cache is not performing as to be expected
Summary
The bootsnap cache is being build, but is being at least partially re-computed upon first start of a container / Rails.
We should investigate as to the how and why this is occurring, and how to reduce the likelihood. Optimize the use of Bootsnap & pre-compiling the cache, which hopefully reduces the need for this recompilation at runtime.
Details
Currently, there is a 15s reduction between first and further runs. This indicates that the Bootsnap cache is being rebuilt, and also leans to an increased container startup time & CPU load to perform this action, in addition to modifications to the existing cache taking time.
git@gke125-production-bz1tbp-toolbox-75df9cd6d5-4bdmz:/$ gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
GitLab: 16.4.0-pre (68b43fa1730) EE
GitLab Shell: 14.27.0
PostgreSQL: 14.8
------------------------------------------------------------[ booted in 49.36s ]
irb(main):001:0> quit
git@gke125-production-bz1tbp-toolbox-75df9cd6d5-4bdmz:/$ gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
GitLab: 16.4.0-pre (68b43fa1730) EE
GitLab Shell: 14.27.0
PostgreSQL: 14.8
------------------------------------------------------------[ booted in 32.60s ]
Loading production environment (Rails 7.0.6)
irb(main):001:0> quit
git@gke125-production-bz1tbp-toolbox-75df9cd6d5-4bdmz:/$ gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
GitLab: 16.4.0-pre (68b43fa1730) EE
GitLab Shell: 14.27.0
PostgreSQL: 14.8
------------------------------------------------------------[ booted in 33.94s ]
Loading production environment (Rails 7.0.6)
irb(main):001:0> quit