diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-01 12:17:37 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-01 22:23:01 -0700 |
commit | 978647c6cb0f81c3695c4d20e98619c2025532c5 (patch) | |
tree | 492b3329f34e97daabc492218e15ed8328adca4a /config | |
parent | df0be8b226bef4f6680719b5b7618d4b7f8a56b5 (diff) | |
download | gitlab-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 'config')
-rw-r--r-- | config/initializers/0_thread_cache.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/config/initializers/0_thread_cache.rb b/config/initializers/0_thread_cache.rb new file mode 100644 index 00000000000..feb8057132e --- /dev/null +++ b/config/initializers/0_thread_cache.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +Gitlab::ThreadMemoryCache.cache_backend |