Commit 09ec232d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Avoid using db load balancing on critical CI path

Running with `bundle exec rake db:drop db:create db:structure:load
db:migrate gitlab:db:setup_ee` could take 97 seconds with database load
balancing, and without it could take just 31 seconds.

This is especially critical for jobs which is needed before the
dependent jobs can run.
parent 42d44783
......@@ -115,6 +115,8 @@ update-storybook-yarn-cache:
needs: ["setup-test-env", "retrieve-tests-metadata", "compile-test-assets"]
variables:
WEBPACK_VENDOR_DLL: "true"
GITLAB_NO_AR_DB_PREPEND_LOAD_BALANCING: "true"
GITLAB_USE_PREPARED_STATEMENTS: "true"
script:
- run_timed_command "gem install knapsack --no-document"
- run_timed_command "scripts/gitaly-test-spawn"
......
......@@ -2,7 +2,7 @@
ActiveRecord::Base.singleton_class.attr_accessor :load_balancing_proxy
Gitlab::Database.main.disable_prepared_statements
Gitlab::Database.main.disable_prepared_statements unless ENV['GITLAB_USE_PREPARED_STATEMENTS'] == 'true'
Gitlab::Application.configure do |config|
config.middleware.use(Gitlab::Database::LoadBalancing::RackMiddleware)
......@@ -11,7 +11,7 @@ end
# This hijacks the "connection" method to ensure both
# `ActiveRecord::Base.connection` and all models use the same load
# balancing proxy.
ActiveRecord::Base.singleton_class.prepend(Gitlab::Database::LoadBalancing::ActiveRecordProxy)
ActiveRecord::Base.singleton_class.prepend(Gitlab::Database::LoadBalancing::ActiveRecordProxy) unless ENV['GITLAB_NO_AR_DB_PREPEND_LOAD_BALANCING'] == 'true'
# The load balancer needs to be configured immediately, and re-configured after
# forking. This ensures queries that run before forking use the load balancer,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment