diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-19 23:00:46 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-19 23:13:44 +0300 |
commit | eedf735574b9f6c7c6c843943dd946ce84238236 (patch) | |
tree | 4004417e33b7dcef1c693d878c4fdc17151d8f60 | |
parent | eb3f465e75ee1fc5ef582e9f01f921626d7cf5cc (diff) |
Make Bootsnap available via ENABLE_BOOTSNAP=1
Bootsnap speeds up Rails loading and now ships by default with Rails 5.2
apps. We should promote this to a default gem and test it out in
production. This will also make it possible for the Helm Charts to take
advantage of this.
It appears that Bootsnap with Rails 5.2.3 and all the GitLab CE gems
loads fine on an ARM platform now, so it's possible that
https://gitlab.com/gitlab-org/gitlab-ce/issues/34799 has been resolved.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/45230
-rw-r--r-- | .gitlab/ci/memory.gitlab-ci.yml | 2 | ||||
-rw-r--r-- | Gemfile | 3 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | changelogs/unreleased/sh-enable-bootsnap.yml | 5 | ||||
-rw-r--r-- | config/boot.rb | 2 |
5 files changed, 11 insertions, 5 deletions
diff --git a/.gitlab/ci/memory.gitlab-ci.yml b/.gitlab/ci/memory.gitlab-ci.yml index ffe5dbdc31b..9923732e587 100644 --- a/.gitlab/ci/memory.gitlab-ci.yml +++ b/.gitlab/ci/memory.gitlab-ci.yml @@ -33,7 +33,7 @@ memory-on-boot: NODE_OPTIONS: --max_old_space_size=3584 script: # Both bootsnap and derailed monkey-patch Kernel#require, which leads to circular dependency - - DISABLE_BOOTSNAP=true PATH_TO_HIT="/users/sign_in" CUT_OFF=0.3 bundle exec derailed exec perf:mem >> 'tmp/memory_on_boot.txt' + - ENABLE_BOOTSNAP=false PATH_TO_HIT="/users/sign_in" CUT_OFF=0.3 bundle exec derailed exec perf:mem >> 'tmp/memory_on_boot.txt' - scripts/generate-memory-metrics-on-boot tmp/memory_on_boot.txt >> 'tmp/memory_on_boot_metrics.txt' artifacts: paths: @@ -2,6 +2,8 @@ source 'https://rubygems.org' gem 'rails', '5.2.3' +gem 'bootsnap', '~> 1.4' + # Improves copy-on-write performance for MRI gem 'nakayoshi_fork', '~> 0.0.4' @@ -329,7 +331,6 @@ group :development do end group :development, :test do - gem 'bootsnap', '~> 1.4' gem 'bullet', '~> 5.5.0', require: !!ENV['ENABLE_BULLET'] gem 'pry-byebug', '~> 3.5.1', platform: :mri gem 'pry-rails', '~> 0.3.4' diff --git a/Gemfile.lock b/Gemfile.lock index 2bcc3527de4..79ec7b36a43 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,7 +100,7 @@ GEM binding_ninja (0.2.3) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootsnap (1.4.1) + bootsnap (1.4.4) msgpack (~> 1.0) bootstrap_form (4.2.0) actionpack (>= 5.0) @@ -529,7 +529,7 @@ GEM mixlib-cli (1.7.0) mixlib-config (2.2.18) tomlrb - msgpack (1.2.10) + msgpack (1.3.0) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.0.0) diff --git a/changelogs/unreleased/sh-enable-bootsnap.yml b/changelogs/unreleased/sh-enable-bootsnap.yml new file mode 100644 index 00000000000..674a900ee01 --- /dev/null +++ b/changelogs/unreleased/sh-enable-bootsnap.yml @@ -0,0 +1,5 @@ +--- +title: Make Bootsnap available via ENABLE_BOOTSNAP=1 +merge_request: 30963 +author: +type: performance diff --git a/config/boot.rb b/config/boot.rb index b76b26a5e75..2eacff868eb 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,7 +3,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) # Set up gems listed in the Gemfile. require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) begin - require 'bootsnap/setup' unless ENV['DISABLE_BOOTSNAP'] + require 'bootsnap/setup' if ENV['RAILS_ENV'] != 'production' || %w(1 yes true).include?(ENV['ENABLE_BOOTSNAP']) rescue LoadError # bootsnap is an optional dependency, so if we don't have it, it's fine end |