summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-01 12:17:37 -0700
committerStan Hu <stanhu@gmail.com>2019-07-01 22:23:01 -0700
commit978647c6cb0f81c3695c4d20e98619c2025532c5 (patch)
tree492b3329f34e97daabc492218e15ed8328adca4a /spec/spec_helper.rb
parentdf0be8b226bef4f6680719b5b7618d4b7f8a56b5 (diff)
downloadgitlab-ce-978647c6cb0f81c3695c4d20e98619c2025532c5.tar.gz
Add a memory cache local to the thread to reduce Redis load
Loading `ApplicationSetting` from Redis was responsible for at least 50% of the CPU load of the Redis cluster on GitLab.com. Since these values generally don't change very much, we can load this from the database and cache it in memory, skipping Redis altogther. We use `ActiveSupport::Cache::MemoryStore` as a drop-in replacement for `RedisCacheStore` even though we probably don't need synchronized access within `Thread.current`. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63977
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 3bd2408dc72..62fdc039b5e 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -139,6 +139,8 @@ RSpec.configure do |config|
allow(Feature).to receive(:enabled?)
.with(:force_autodevops_on_by_default, anything)
.and_return(false)
+
+ Gitlab::ThreadMemoryCache.cache_backend.clear
end
config.around(:example, :quarantine) do