From 978647c6cb0f81c3695c4d20e98619c2025532c5 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 1 Jul 2019 12:17:37 -0700 Subject: 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 --- spec/spec_helper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spec/spec_helper.rb') 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 -- cgit v1.2.1