Skip to content
  • Stan Hu's avatar
    Improve cache hit rates with Rails Bootsnap cache · f565910a
    Stan Hu authored
    Previously the Bootsnap cache was populated with `rake about`.  While
    this loads the Rails environment, it does not load a significant
    amount of the GitLab Rails code.
    
    This commit adds a separate image layer to populate the Bootsnap
    cache. It does the following:
    
    1. Builds `gitlab-rails-{ce,ee}` image.
    2. Uses docker-compose to spin up a PostgreSQL, Redis, and the Rails image to
    start `gitlab-rails runner`.
    3. Builds a `gitlab-rails-bootsnap-{ce,ee}` image that contains the
    Bootsnap cache in `/srv/gitlab/bootsnap`.
    
    Images such as `gitlab-webservice-ee` then use
    `gitlab-rails-bootsnap-ee` instead of `gitlab-rails-ee`.
    
    This improves the hit rate significantly. Setting the `BOOTSNAP_LOG`
    environment variable shows that previously there were 11,567 and
    11,553 "[Bootsnap] miss" messages in `webservice` and `sidekiq`,
    respectively. After this change, the number dropped to 29 and 26,
    respectively.
    
    More importantly, the startup times dropped about 15 seconds a...
    f565910a