diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-01 22:17:37 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-02 08:23:01 +0300 |
commit | 978647c6cb0f81c3695c4d20e98619c2025532c5 (patch) | |
tree | 492b3329f34e97daabc492218e15ed8328adca4a /spec | |
parent | df0be8b226bef4f6680719b5b7618d4b7f8a56b5 (diff) |
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')
-rw-r--r-- | spec/spec_helper.rb | 2 |
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 |